1.1 --- a/test/harness/testcase.c Fri Jan 27 10:30:16 2012 +0000
1.2 +++ b/test/harness/testcase.c Fri Jan 27 16:18:02 2012 +0000
1.3 @@ -21,23 +21,23 @@
1.4 char *s;
1.5 for(;;)
1.6 {
1.7 - s=str_dup(template);
1.8 + s=g_strdup(template);
1.9 mktemp(s);
1.10 if (!*s)
1.11 {
1.12 errno=EEXIST;
1.13 - mem_free(s);
1.14 + g_free(s);
1.15 return -1;
1.16 }
1.17 fd=open(s,O_RDWR|O_CREAT|O_EXCL,0600);
1.18 if (fd>0)
1.19 {
1.20 strcpy(template,s);
1.21 - mem_free(s);
1.22 + g_free(s);
1.23 return fd;
1.24 }
1.25 else
1.26 - mem_free(s);
1.27 + g_free(s);
1.28 }
1.29 }
1.30 #endif /* !HAVE_MKSTEMP */
1.31 @@ -100,16 +100,16 @@
1.32 * TRUE on pass or expected-fail.
1.33 * Suitable message(s) will be printed in all cases.
1.34 */
1.35 -boolean testcase_run(Testcase *testcase)
1.36 +gboolean testcase_run(Testcase *testcase)
1.37 {
1.38 - boolean r;
1.39 + gboolean r;
1.40 int fd,exit_status,col;
1.41 size_t n,pos,offset,header_len;
1.42 FILE *fp;
1.43 char input[]="TEST-XXXXXX";
1.44 char *endp,*bol;
1.45 char *command[3];
1.46 - String *expected,*report;
1.47 + GString *expected,*report;
1.48 char *output;
1.49 fd=mkstemp(input);
1.50 if (testcase->input)
1.51 @@ -126,7 +126,7 @@
1.52 close(fd);
1.53 command[0]=getenv("BOOKLOUPE");
1.54 if (!command[0])
1.55 - command[0]="." BL_DIR_SEPARATOR_S "bookloupe";
1.56 + command[0]="." G_DIR_SEPARATOR_S "bookloupe";
1.57 command[1]=input;
1.58 command[2]=NULL;
1.59 if (testcase->expected)
1.60 @@ -141,11 +141,11 @@
1.61 return FALSE;
1.62 if (testcase->expected)
1.63 {
1.64 - expected=string_new("\n\nFile: ");
1.65 - string_append(expected,input);
1.66 - string_append(expected,"\n\n\n");
1.67 + expected=g_string_new("\n\nFile: ");
1.68 + g_string_append(expected,input);
1.69 + g_string_append(expected,"\n\n\n");
1.70 header_len=expected->len;
1.71 - string_append(expected,testcase->expected);
1.72 + g_string_append(expected,testcase->expected);
1.73 }
1.74 else
1.75 {
1.76 @@ -163,8 +163,8 @@
1.77 endp=strchr(output+offset,'\n');
1.78 if (!endp)
1.79 endp=output+strlen(output);
1.80 - report=string_new(NULL);
1.81 - string_append_len(report,output,endp-output);
1.82 + report=g_string_new(NULL);
1.83 + g_string_append_len(report,output,endp-output);
1.84 bol=strrchr(report->str,'\n');
1.85 if (bol)
1.86 bol++;
1.87 @@ -176,14 +176,14 @@
1.88 fprintf(stderr,"%s\n%*s^\n",report->str+header_len,col,"");
1.89 else
1.90 fprintf(stderr,"%s\n%*s^\n",report->str,col,"");
1.91 - string_free(report,TRUE);
1.92 + g_string_free(report,TRUE);
1.93 }
1.94 - string_free(expected,TRUE);
1.95 - mem_free(output);
1.96 + g_string_free(expected,TRUE);
1.97 + g_free(output);
1.98 return FALSE;
1.99 }
1.100 - string_free(expected,TRUE);
1.101 - mem_free(output);
1.102 + g_string_free(expected,TRUE);
1.103 + g_free(output);
1.104 if (exit_status)
1.105 fprintf(stderr,"bookloupe exited with code %d\n",r);
1.106 if (!exit_status)
1.107 @@ -196,8 +196,8 @@
1.108 */
1.109 void testcase_free(Testcase *testcase)
1.110 {
1.111 - mem_free(testcase->basename);
1.112 - mem_free(testcase->input);
1.113 - mem_free(testcase->expected);
1.114 - mem_free(testcase);
1.115 + g_free(testcase->basename);
1.116 + g_free(testcase->input);
1.117 + g_free(testcase->expected);
1.118 + g_free(testcase);
1.119 }