[90500] trunk/dports/python/py-pylibmc

snc at macports.org snc at macports.org
Wed Mar 7 08:10:00 PST 2012


Revision: 90500
          http://trac.macports.org/changeset/90500
Author:   snc at macports.org
Date:     2012-03-07 08:09:59 -0800 (Wed, 07 Mar 2012)
Log Message:
-----------
py-pylibmc: define our own strndup on Snow Leopard, #32678

Modified Paths:
--------------
    trunk/dports/python/py-pylibmc/Portfile

Added Paths:
-----------
    trunk/dports/python/py-pylibmc/files/
    trunk/dports/python/py-pylibmc/files/patch-pylibmcmodule.c.diff

Modified: trunk/dports/python/py-pylibmc/Portfile
===================================================================
--- trunk/dports/python/py-pylibmc/Portfile	2012-03-07 16:06:48 UTC (rev 90499)
+++ trunk/dports/python/py-pylibmc/Portfile	2012-03-07 16:09:59 UTC (rev 90500)
@@ -6,7 +6,7 @@
 
 name                py-pylibmc
 version             1.2.2
-revision            1
+revision            2
 categories          python
 license             BSD
 platforms           darwin
@@ -29,6 +29,10 @@
 python.versions     25 26 27
 python.default_version  27
 
+platform darwin 10 {
+    patchfiles      patch-pylibmcmodule.c.diff
+}
+
 if {$subport != $name} {
     depends_lib-append  port:libmemcached \
                         port:py${python.version}-distribute

Added: trunk/dports/python/py-pylibmc/files/patch-pylibmcmodule.c.diff
===================================================================
--- trunk/dports/python/py-pylibmc/files/patch-pylibmcmodule.c.diff	                        (rev 0)
+++ trunk/dports/python/py-pylibmc/files/patch-pylibmcmodule.c.diff	2012-03-07 16:09:59 UTC (rev 90500)
@@ -0,0 +1,28 @@
+--- _pylibmcmodule.c.orig	2012-03-07 11:00:09.000000000 -0500
++++ _pylibmcmodule.c	2012-03-07 11:03:21.000000000 -0500
+@@ -46,6 +46,25 @@
+     { Py_INCREF(obj); \
+       PyModule_AddObject(mod, nam, obj); }
+ 
++/**
++ * Copy at most @p size characters from @p src, plus a terminating nul.
++ **/
++char *strndup(const char *src, size_t size); 
++char *strndup(const char *src, size_t size){
++  size_t l = strlen(src);
++  char *r = NULL;
++
++  if (l < size)
++    return strdup(src);
++
++  r = (char *) malloc(size+1);
++  if (r == NULL)
++    return NULL;
++
++  strncpy(r, src, size);
++  r[size] ='\0';
++  return r;
++}
+ 
+ /* {{{ Type methods */
+ static PylibMC_Client *PylibMC_ClientType_new(PyTypeObject *type,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120307/928a52ce/attachment.html>


More information about the macports-changes mailing list