# New Ticket Created by  Klaas-Jan Stol 
# Please include the string:  [perl #41602]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41602 >


hi,

as of Microsoft visual studio 2005, the function 'strdup' is deprecated.

Attached is a patch fixing:

* add a file parrot/config/gen/platform/win32/string.h, checking for the
compiler; if it is MSVS 2005, strdup is defined as _strdup
* add the same file to be included, by config/gen/platform.pm

There should be more string functions deprecated. As long as Parrot
doesn't use them, they can be left out (no unnecessary #defines).

(On a personal note: I wondered for a minute if strdup should be used,
as it malloc's memory for the string, and then it's out of control of
the garbage collector. Is this an issue? I'm not familiar with memory
stuff in parrot.)

regards,
klaas-jan

Index: config/gen/platform.pm
===================================================================
--- config/gen/platform.pm	(revision 17163)
+++ config/gen/platform.pm	(working copy)
@@ -68,6 +68,7 @@
         signal.h
         stat.h
         threads.h
+        string.h
         /;
 
     open my $PLATFORM_H, ">", "include/parrot/platform.h"
Index: config/gen/platform/win32/string.h
===================================================================
--- config/gen/platform/win32/string.h	(revision 0)
+++ config/gen/platform/win32/string.h	(revision 0)
@@ -0,0 +1,21 @@
+#ifndef PLATFORM_WIN32_STRING_H
+#define PLATFORM_WIN32_STRING_H
+
+#include <string.h>
+
+#ifdef _MSC_VER
+#  if _MSC_VER >= 1400
+#    define strdup _strdup
+#  endif
+#endif
+
+
+#endif
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+

Reply via email to