You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/05/25 03:30:45 UTC

svn commit: r1127355 - /subversion/trunk/subversion/libsvn_subr/deprecated.c

Author: danielsh
Date: Wed May 25 01:30:45 2011
New Revision: 1127355

URL: http://svn.apache.org/viewvc?rev=1127355&view=rev
Log:
Allocate a struct on the stack.

Suggested by: gstein

* subversion/libsvn_subr/deprecated.c
  (svn_io_file_create): Shallow copy the C string to a stack svn_string_t.

Modified:
    subversion/trunk/subversion/libsvn_subr/deprecated.c

Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1127355&r1=1127354&r2=1127355&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_subr/deprecated.c Wed May 25 01:30:45 2011
@@ -634,10 +634,17 @@ svn_io_file_create(const char *file,
                    const char *contents,
                    apr_pool_t *pool)
 {
-  const svn_string_t *contents_string;
-
-  contents_string = (contents ? svn_string_create(contents, pool) : NULL);
-  return svn_io_file_create2(file, contents_string, pool);
+  if (contents && *contents)
+    { 
+      svn_string_t contents_string;
+      contents_string.data = contents;
+      contents_string.len = strlen(contents);
+      return svn_io_file_create2(file, &contents_string, pool);
+    }
+  else
+    {
+      return svn_io_file_create2(file, NULL, pool);
+    }
 }
 
 svn_error_t *