]> git.mxchange.org Git - simgear.git/commitdiff
Removed an unnecessary string allocation during copying.
authordavid <david>
Fri, 22 Mar 2002 15:02:50 +0000 (15:02 +0000)
committerdavid <david>
Fri, 22 Mar 2002 15:02:50 +0000 (15:02 +0000)
simgear/misc/props.cxx

index fc0e549affe34c7d5a89d8fc821c245619b2f956..9aeb2385450b8c1e0678dc824dacc35cfa6dec13 100644 (file)
@@ -221,9 +221,8 @@ copy_string (const char * s)
                                // FIXME: potential buffer overflow.
                                // For some reason, strnlen and
                                // strncpy cause all kinds of crashes.
                                // FIXME: potential buffer overflow.
                                // For some reason, strnlen and
                                // strncpy cause all kinds of crashes.
-  string str = s;
-  char * copy = new char[str.size() + 1];
-  strcpy(copy, str.c_str());
+  char * copy = new char[strlen(s) + 1];
+  strcpy(copy, s);
   return copy;
 }
 
   return copy;
 }