[llvm-commits] CVS: llvm/tools/gccld/gccld.cpp

John Criswell criswell at cs.uiuc.edu
Wed Sep 17 14:15:01 PDT 2003


Changes in directory llvm/tools/gccld:

gccld.cpp updated: 1.48 -> 1.49

---
Log message:

Replaced the call to strdup() with a new operator followed by a strcpy().
This should prevent calls to the new oerator and malloc.



---
Diffs of the changes:

Index: llvm/tools/gccld/gccld.cpp
diff -u llvm/tools/gccld/gccld.cpp:1.48 llvm/tools/gccld/gccld.cpp:1.49
--- llvm/tools/gccld/gccld.cpp:1.48	Wed Sep 17 14:04:22 2003
+++ llvm/tools/gccld/gccld.cpp	Wed Sep 17 14:14:41 2003
@@ -382,7 +382,8 @@
   entries = 0;
   while (envp[entries] != NULL)
   {
-    newenv[entries] = strdup (envp[entries]);
+    newenv[entries] = new char[strlen (envp[entries]) + 1];
+    strcpy (newenv[entries], envp[entries]);
     ++entries;
   }
   newenv[entries] = NULL;





More information about the llvm-commits mailing list