lericson/pylibmc — Issue #59: #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
Author: radek-senfeld
Created: 2011-10-11 20:08:31+00:00
State: open

Hi, guys!

I'm pretty sure that "#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT" should be changed to "#if LIBMEMCACHED_WITH_SASL_SUPPORT".

I'm using libmemcached 0.53 with disabled SASL support. You may find "#define LIBMEMCACHED_WITH_SASL_SUPPORT 0" line in libmemcached/configure.h - macro defined but false.

Proposed patch

--- _pylibmcmodule.c.orig 2011-09-16 17:11:32.000000000 +0200
+++ _pylibmcmodule.c 2011-10-11 21:32:33.000000000 +0200
@@ -65,7 +65,7 @@

static void PylibMC_ClientType_dealloc(PylibMC_Client *self) {
if (self->mc != NULL) {
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+#if LIBMEMCACHED_WITH_SASL_SUPPORT
if (self->sasl_set) {
memcached_destroy_sasl_auth_data(self->mc);
}
@@ -98,7 +98,7 @@
/* setup sasl */
if (user != NULL || pass != NULL) {

-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+#if LIBMEMCACHED_WITH_SASL_SUPPORT
if (user == NULL || pass == NULL) {
PyErr_SetString(PyExc_TypeError, "SASL requires both username and password");
goto error;
@@ -2019,7 +2019,7 @@
}

static int _init_sasl(void) {
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+#if LIBMEMCACHED_WITH_SASL_SUPPORT
int rc;

/* sasl_client_init needs to be called once before using SASL, and
@@ -2168,7 +2168,7 @@
PyModule_AddStringConstant(module,
"libmemcached_version", LIBMEMCACHED_VERSION_STRING);

-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+#if LIBMEMCACHED_WITH_SASL_SUPPORT
PyModule_ADD_REF(module, "support_sasl", Py_True);
#else
PyModule_ADD_REF(module, "support_sasl", Py_False);