tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r439822 - /tomcat/connectors/trunk/jk/native/common/jk_util.c
Date Sun, 03 Sep 2006 18:33:42 GMT
Author: rjung
Date: Sun Sep  3 11:33:42 2006
New Revision: 439822

URL: http://svn.apache.org/viewvc?view=rev&rev=439822
Log:
Make jk_is_some_property more precise by adding a
separator character before the suffix. Otherwise code could
break by simply chosing an unfortunate name for a new
attribute.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_util.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?view=diff&rev=439822&r1=439821&r2=439822
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sun Sep  3 11:33:42 2006
@@ -1171,14 +1171,18 @@
     return JK_FALSE;
 }
 
-static int jk_is_some_property(const char *prp_name, const char *suffix)
+static int jk_is_some_property(const char *prp_name, const char *suffix, const char *sep)
 {
+    char buf[1024];
+
     if (prp_name && suffix) {
+        strcpy(buf, sep);
+        strcat(buf, suffix);
         size_t prp_name_len = strlen(prp_name);
-        size_t suffix_len = strlen(suffix);
+        size_t suffix_len = strlen(buf);
         if (prp_name_len >= suffix_len) {
             const char *prp_suffix = prp_name + prp_name_len - suffix_len;
-            if (0 == strcmp(suffix, prp_suffix)) {
+            if (0 == strcmp(buf, prp_suffix)) {
                 return JK_TRUE;
             }
         }
@@ -1189,19 +1193,19 @@
 
 int jk_is_path_property(const char *prp_name)
 {
-    return jk_is_some_property(prp_name, "path");
+    return jk_is_some_property(prp_name, "path", "_");
 }
 
 int jk_is_cmd_line_property(const char *prp_name)
 {
-    return jk_is_some_property(prp_name, CMD_LINE_OF_WORKER);
+    return jk_is_some_property(prp_name, CMD_LINE_OF_WORKER, ".");
 }
 
 int jk_is_unique_property(const char *prp_name)
 {
     const char **props = &unique_properties[0];
     while (*props) {
-        if (jk_is_some_property(prp_name, *props))
+        if (jk_is_some_property(prp_name, *props, "."))
             return JK_TRUE;
         props++;
     }
@@ -1212,7 +1216,7 @@
 {
     const char **props = &deprecated_properties[0];
     while (*props) {
-        if (jk_is_some_property(prp_name, *props))
+        if (jk_is_some_property(prp_name, *props, "."))
             return JK_TRUE;
         props++;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message