]> granicus.if.org Git - apache/commitdiff
Simplify dav_propdb_define_namespaces(); since we're putting the value in
authorGreg Stein <gstein@apache.org>
Tue, 18 Sep 2001 08:40:25 +0000 (08:40 +0000)
committerGreg Stein <gstein@apache.org>
Tue, 18 Sep 2001 08:40:25 +0000 (08:40 +0000)
the pool (now), forget the stack-based buffer altogether.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91067 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/fs/dbm.c

index c0efe55e86de918de2dff609e4b07bfb1d4058dc..f58d16a171b977a504b5e9d76dd6c49c62242c91 100644 (file)
@@ -534,22 +534,16 @@ static void dav_propdb_close(dav_db *db)
 
 static dav_error * dav_propdb_define_namespaces(dav_db *db, dav_xmlns_info *xi)
 {
-    int ns = db->ns_count;
+    int ns;
     const char *uri = db->ns_table.buf + sizeof(dav_propdb_metadata);
-    char prefix[23];    /* "ns" + 20 digits + '\0' */
-
-    prefix[0] = 'n';
-    prefix[1] = 's';
 
     /* within the prop values, we use "ns%d" for prefixes... register them */
     for (ns = 0; ns < db->ns_count; ++ns, uri += strlen(uri) + 1) {
-        sprintf(&prefix[2], "%d", ns);
 
-        /* prefix is on the stack, and ns_table.buf can move, so copy the
-           two strings (and we simply want the values to last as long as
-           the provided dav_xmlns_info). */
+        /* ns_table.buf can move, so copy its value (we want the values to
+           last as long as the provided dav_xmlns_info). */
         dav_xmlns_add(xi,
-                      apr_pstrdup(xi->pool, prefix),
+                      apr_psprintf(xi->pool, "ns%d", ns),
                       apr_pstrdup(xi->pool, uri));
     }