[SSSD] [PATCH] Fix compilation error in Python murmurhash bindings

Jakub Hrozek jhrozek at redhat.com
Thu Aug 16 09:05:26 UTC 2012


The attached patch fixes compiling the python murmurhash bindings on
RHEL5.
-------------- next part --------------
>From 0c7f2b5aa97fae3ac874ca2f405b30b72decbc64 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Thu, 16 Aug 2012 04:56:47 -0400
Subject: [PATCH] Fix compilation error in Python murmurhash bindings

The compilation produced an error due to missing declaration of uint32_t
and a couple of warnings caused by different prototypes of argument
parsing functions in older Python releases.
---
 src/python/pysss_murmur.c | 12 ++++++++----
 src/util/murmurhash3.h    |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/python/pysss_murmur.c b/src/python/pysss_murmur.c
index 1e89681c8aa0aeacc90d531a49904f81b936cd05..a193c56da08eb8aba09f88ddc10e23625dbe8f0c 100644
--- a/src/python/pysss_murmur.c
+++ b/src/python/pysss_murmur.c
@@ -19,6 +19,7 @@
 */
 
 #include <Python.h>
+#include "util/sss_python.h"
 
 #include "util/murmurhash3.h"
 
@@ -36,7 +37,8 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject *args)
     long long seed;
     uint32_t hash;
 
-    if (!PyArg_ParseTuple(args, "slL", &key, &key_len, &seed)) {
+    if (!PyArg_ParseTuple(args, sss_py_const_p(char, "slL"),
+                          &key, &key_len, &seed)) {
         PyErr_Format(PyExc_ValueError, "Invalid argument\n");
         return NULL;
     }
@@ -53,13 +55,15 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject *args)
 }
 
 static PyMethodDef methods[] = {
-    {"murmurhash3", (PyCFunction) py_murmurhash3, METH_VARARGS, murmurhash3_doc},
-    {NULL,NULL, 0, NULL}
+    { sss_py_const_p(char, "murmurhash3"), (PyCFunction) py_murmurhash3,
+      METH_VARARGS, murmurhash3_doc },
+    { NULL,NULL, 0, NULL }
 };
 
 
 PyMODINIT_FUNC
 initpysss_murmur(void)
 {
-    Py_InitModule3("pysss_murmur", methods, "murmur hash functions");
+    Py_InitModule3(sss_py_const_p(char, "pysss_murmur"),
+                   methods, sss_py_const_p(char, "murmur hash functions"));
 }
diff --git a/src/util/murmurhash3.h b/src/util/murmurhash3.h
index 9174554b929e10f2deb5bac76cffc1d56b947d4c..db7d8a48c4680f5aa21d29f5e4607b0c4618203c 100644
--- a/src/util/murmurhash3.h
+++ b/src/util/murmurhash3.h
@@ -6,5 +6,7 @@
  * clients can be both 64 or 32 bit at the same time.
  */
 
+#include <stdint.h>
+
 uint32_t murmurhash3(const char *key, int len, uint32_t seed);
 
-- 
1.7.11.2



More information about the sssd-devel mailing list