svn commit: trunk/uClibc: libc/inet test/regex

vda at uclibc.org vda at uclibc.org
Wed Dec 17 01:28:36 UTC 2008


Author: vda
Date: 2008-12-16 17:28:36 -0800 (Tue, 16 Dec 2008)
New Revision: 24433

Log:
resolv: fix testcase failure
test/regex/tst-regex2.c: fix testcase to compile with just "gcc <file>.c"



Modified:
   trunk/uClibc/libc/inet/resolv.c
   trunk/uClibc/test/regex/tst-regex2.c


Changeset:
Modified: trunk/uClibc/libc/inet/resolv.c
===================================================================
--- trunk/uClibc/libc/inet/resolv.c	2008-12-16 15:40:15 UTC (rev 24432)
+++ trunk/uClibc/libc/inet/resolv.c	2008-12-17 01:28:36 UTC (rev 24433)
@@ -1462,9 +1462,9 @@
 			*result = NULL;
 			return errno;
 		}
+		addr_list[0] = in;
+		addr_list[1] = NULL;
 	}
-	addr_list[0] = in;
-	addr_list[1] = NULL;
 
 	*h_errnop = HOST_NOT_FOUND;
 	while (fgets(buf, buflen, fp)) {

Modified: trunk/uClibc/test/regex/tst-regex2.c
===================================================================
--- trunk/uClibc/test/regex/tst-regex2.c	2008-12-16 15:40:15 UTC (rev 24432)
+++ trunk/uClibc/test/regex/tst-regex2.c	2008-12-17 01:28:36 UTC (rev 24433)
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE 1
+
 #include <fcntl.h>
 #include <locale.h>
 #include <regex.h>
@@ -42,8 +44,8 @@
       return 1;
     }
 
-  struct stat64 st;
-  if (fstat64 (fd, &st) < 0)
+  struct stat st;
+  if (fstat (fd, &st) < 0)
     {
       printf ("Couldn't fstat ChangeLog.14: %s\n", strerror(errno));
       return 1;
@@ -71,9 +73,10 @@
 
   char *string = buf;
   size_t len = st.st_size;
+  int testno, i;
 
-  for (int testno = 0; testno < 4; ++testno)
-    for (int i = 0; i < sizeof (pat) / sizeof (pat[0]); ++i)
+  for (testno = 0; testno < 4; ++testno)
+    for (i = 0; i < sizeof (pat) / sizeof (pat[0]); ++i)
       {
 	printf ("test %d pattern %d", testno, i);
 
@@ -142,9 +145,10 @@
 		  return 1;
 		}
 
+	      int j, k, l;
 	      if (i > 0)
-		for (int j = 0, l = 1; j < 7; ++j)
-		  for (int k = 0; k < (i == 1 ? 1 : 10); ++k, ++l)
+		for (j = 0, l = 1; j < 7; ++j)
+		  for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l)
 		    if (pmatch[l].rm_so != pmatch[0].rm_so + j
 			|| pmatch[l].rm_eo != pmatch[l].rm_so + 1)
 		      {
@@ -199,9 +203,10 @@
 		  return 1;
 		}
 
+	      int j, k, l;
 	      if (i > 0)
-		for (int j = 0, l = 1; j < 7; ++j)
-		  for (int k = 0; k < (i == 1 ? 1 : 10); ++k, ++l)
+		for (j = 0, l = 1; j < 7; ++j)
+		  for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l)
 		    if (regs.start[l] != match + j
 			|| regs.end[l] != regs.start[l] + 1)
 		      {




More information about the uClibc-cvs mailing list