From 92fe614f3b30b8c002ac4b8d12e0d38135bf2c13 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 5 Nov 2006 22:57:01 +0000 Subject: fix some variable usage bugs in READ_* marcos and change protocol debugging marcos to not use variadic arguments git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@71 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd-common.h | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'nslcd-common.h') diff --git a/nslcd-common.h b/nslcd-common.h index 470809a..e69b924 100644 --- a/nslcd-common.h +++ b/nslcd-common.h @@ -11,34 +11,33 @@ int32_t tmpint32; - temporary variable */ +#define DEBUG_PRINT_OLD(...) fprintf(stderr, ## args) #ifdef DEBUG_PROT -#define DEBUG_PRINT(args...) fprintf(stderr, ## args) +#define DEBUG_PRINT(fmt,arg) fprintf(stderr,fmt,arg) #else /* DEBUG_PROT */ -#define DEBUG_PRINT(args...) +#define DEBUG_PRINT(fmt,arg) #endif /* not DEBUG_PROT */ #define WRITE(fp,ptr,size) \ - DEBUG_PRINT("WRITE()\n"); \ + DEBUG_PRINT("WRITE: %d bytes\n",(int)size); \ if (fwrite(ptr,size,1,fp)<1) \ { ERROR_OUT_WRITEERROR(fp) } #define WRITE_TYPE(fp,field,type) \ - DEBUG_PRINT("WRITE_TYPE()\n"); \ WRITE(fp,&(field),sizeof(type)) #define WRITE_INT32(fp,i) \ - DEBUG_PRINT("WRITE_INT32(%d)\n",(int)i); \ + DEBUG_PRINT("WRITE: int32=%d\n",(int)i); \ tmpint32=(int32_t)(i); \ WRITE_TYPE(fp,tmpint32,int32_t) #define WRITE_STRING(fp,str) \ - DEBUG_PRINT("WRITE_STRING(\"%s\"=%d)\n",str,strlen(str)); \ + DEBUG_PRINT("WRITE: string=\"%s\"\n",str); \ WRITE_INT32(fp,strlen(str)); \ if (tmpint32>0) \ { WRITE(fp,str,tmpint32); } #define WRITE_FLUSH(fp) \ - DEBUG_PRINT("WRITE_FLUSH()\n"); \ if (fflush(fp)<0) \ { ERROR_OUT_WRITEERROR(fp) } @@ -53,12 +52,12 @@ #define WRITE_STRINGLIST_NULLTERM(fp,arr) \ /* first determin length of array */ \ - for (tmpint32=0;(arr)[tmpint32]!=NULL;tmpint32++) \ + for (tmp3int32=0;(arr)[tmp3int32]!=NULL;tmp3int32++) \ /*noting*/ ; \ /* write number of strings */ \ - WRITE_TYPE(fp,tmpint32,int32_t); \ + WRITE_TYPE(fp,tmp3int32,int32_t); \ /* write strings */ \ - for (tmp2int32=0;tmp2int32