In url_match(), check the right member for NULL when determining
authorFabian Keil <fk@fabiankeil.de>
Thu, 10 Apr 2008 04:17:56 +0000 (04:17 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 10 Apr 2008 04:17:56 +0000 (04:17 +0000)
whether there's a path regex to execute. Looking for a plain-text
representation works as well, but it looks "interesting" and that
member will be removed soonish anyway.

urlmatch.c

index 1c4963a..257ee96 100644 (file)
@@ -1,4 +1,4 @@
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.27 2008/04/08 15:44:33 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.28 2008/04/08 16:07:39 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
@@ -33,6 +33,10 @@ const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.27 2008/04/08 15:44:33 fabianke
  *
  * Revisions   :
  *    $Log: urlmatch.c,v $
  *
  * Revisions   :
  *    $Log: urlmatch.c,v $
+ *    Revision 1.28  2008/04/08 16:07:39  fabiankeil
+ *    Make it harder to mistake url_match()'s
+ *    second parameter for an url_spec.
+ *
  *    Revision 1.27  2008/04/08 15:44:33  fabiankeil
  *    Save a bit of memory (and a few cpu cycles) by not bothering to
  *    compile slash-only path regexes that don't affect the result.
  *    Revision 1.27  2008/04/08 15:44:33  fabiankeil
  *    Save a bit of memory (and a few cpu cycles) by not bothering to
  *    compile slash-only path regexes that don't affect the result.
@@ -1135,7 +1139,7 @@ int url_match(const struct url_spec *pattern,
 #else
 #define DOMAIN_MATCHES ((NULL == pattern->dbuffer) || (0 == domain_match(pattern, http)))
 #endif
 #else
 #define DOMAIN_MATCHES ((NULL == pattern->dbuffer) || (0 == domain_match(pattern, http)))
 #endif
-#define PATH_MATCHES ((NULL == pattern->path) || (0 == regexec(pattern->preg, http->path, 0, NULL, 0)))
+#define PATH_MATCHES ((NULL == pattern->preg) || (0 == regexec(pattern->preg, http->path, 0, NULL, 0)))
 
    if (pattern->tag_regex != NULL)
    {
 
    if (pattern->tag_regex != NULL)
    {