Patch from Scott McKellar: This patch elinminates the use of the osrf_clearbuf macro in several spots. In each case, the buffer needs to be initialized to an empty string, because the call to jid_get_* doesn't necessarily populate it with anything else. In debugging mode, osrf_clearbuf() will fill the field with exclamation points, which is not helpful in this context. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1302 9efc2488-bf62-4759-914b-345cdb29e865
Patch that: 1) Creates safe_calloc, suggested by Scott McKellar which includes memset, as calloc does. safe_malloc will eventually lose its call to memset. 2) Creates a macro in utils.h called osrf_clearbuf which * under CLFAGS=-DNDEBUG fills the buffer with !s and a trailing nul * otherwise (currently) uses memset to fill with nuls The secondary behavior should be changed to a no-op after no more problems arise under NDEBUG mode. I reversed the suggested semantics because I'm not ready to completely break trunk. To break everything (AKA find where we should be providing a terminal nul) just compile like this: $ CLFAGS=-DNDEBUG make clean all 3) replaces all memsets (excepting the ones in safe_?alloc) that act on char bufs with said macro, so they can be spotted and improved to deal with nul terminators where needed. I didn't touch any memsets on struct pointers. 4) made jid_get_*() from src/libopensrf/transport_message.c safe for use with NDEBUG mode. They were depending on the target buffer that the caller passes in to be nul-filled (they use strncpy/memcpy which don't guarantee terminal nul) -- now they provide their own terminal nul. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1099 9efc2488-bf62-4759-914b-345cdb29e865
Broad patch from Dan Scott to move towards better memory management: * bzero->memset (with sizeof) - except when followed immediately by snprintf(), in which case the call was deleted completely * sprintf->snprintf (with sizeof) - for the C99-guaranteed null-terminated string and avoidance of overwrites * fgets (with sizeof) - because in at least one case "len - 1" was being used for the length, even though fgets is defined to retrieve 1 byte less than the requested length - so the code was effectively retrieving 2 bytes less than the allocated buffer * in 2 places in srfsh.c, increased buffer size by 1 to allow for null terminator * various typo fixes git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1098 9efc2488-bf62-4759-914b-345cdb29e865
Merged libopensrf source directories (libtransport, libstack, and utils) into a single libopensrf directory Moved opensrf headers to trunk/include/opensrf Moved objson headers to trunk/include/objson Updated #include's throughout to be fully qualified. e.g. <opensrf/utils.h>, <objson/object.h> Removed old, unused trunk/src/xinclude code Cleaned up Makefiles to support new directory layout git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@957 9efc2488-bf62-4759-914b-345cdb29e865