libxml2 r3697 - trunk



Author: veillard
Date: Thu Feb 21 22:31:55 2008
New Revision: 3697
URL: http://svn.gnome.org/viewvc/libxml2?rev=3697&view=rev

Log:
* debugXML.c: made one of the changes suggested by Brian Krahmer
* testRegexp.c: allow to pass '--' on the command line to allow
  regexps starting with the character '-'
Daniel


Modified:
   trunk/ChangeLog
   trunk/debugXML.c
   trunk/testRegexp.c

Modified: trunk/debugXML.c
==============================================================================
--- trunk/debugXML.c	(original)
+++ trunk/debugXML.c	Thu Feb 21 22:31:55 2008
@@ -3244,6 +3244,7 @@
                             "Unknown command %s\n", command);
         }
         free(cmdline);          /* not xmlFree here ! */
+	cmdline = NULL;
     }
 #ifdef LIBXML_XPATH_ENABLED
     xmlXPathFreeContext(ctxt->pctxt);

Modified: trunk/testRegexp.c
==============================================================================
--- trunk/testRegexp.c	(original)
+++ trunk/testRegexp.c	Thu Feb 21 22:31:55 2008
@@ -290,6 +290,9 @@
 
 	if (argv[i][0] != '-')
 	    continue;
+	if (!strcmp(argv[i], "--"))
+	    break;
+
 	if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) {
 	    debug++;
 	} else if ((!strcmp(argv[i], "-repeat")) ||
@@ -322,10 +325,15 @@
 #endif
 	    testRegexpFile(filename);
     } else {
+        int  data = 0;
 #ifdef LIBXML_EXPR_ENABLED
+
         if (use_exp) {
 	    for (i = 1; i < argc ; i++) {
-		if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
+	        if (strcmp(argv[i], "--") == 0)
+		    data = 1;
+		else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) ||
+		    (data == 1)) {
 		    if (pattern == NULL) {
 			pattern = argv[i];
 			printf("Testing expr %s:\n", pattern);
@@ -342,13 +350,18 @@
 		    }
 		}
 	    }
-	    if (expr != NULL)
+	    if (expr != NULL) {
 		xmlExpFree(ctxt, expr);
+		expr = NULL;
+	    }
 	} else
 #endif
         {
 	    for (i = 1; i < argc ; i++) {
-		if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
+	        if (strcmp(argv[i], "--") == 0)
+		    data = 1;
+		else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) ||
+		         (data == 1)) {
 		    if (pattern == NULL) {
 			pattern = argv[i];
 			printf("Testing %s:\n", pattern);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]