[open-ils-commits] r7852 - in trunk/Open-ILS/src: apachemods c-apps
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Sep 30 14:57:28 EDT 2007
Author: miker
Date: 2007-09-30 14:47:04 -0400 (Sun, 30 Sep 2007)
New Revision: 7852
Modified:
trunk/Open-ILS/src/apachemods/mod_rest_gateway.c
trunk/Open-ILS/src/apachemods/mod_xmlbuilder.c
trunk/Open-ILS/src/apachemods/mod_xmlent.c
trunk/Open-ILS/src/c-apps/oils_cstore.c
trunk/Open-ILS/src/c-apps/oils_event.c
trunk/Open-ILS/src/c-apps/oils_fetch.c
trunk/Open-ILS/src/c-apps/oils_utils.c
Log:
Patch from Dan Scott to remove bzero in favor of memset (which may also go
away) and use sizeof instead of static lengths in memset and snprintf.
Modified: trunk/Open-ILS/src/apachemods/mod_rest_gateway.c
===================================================================
--- trunk/Open-ILS/src/apachemods/mod_rest_gateway.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/apachemods/mod_rest_gateway.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -85,12 +85,12 @@
}
char body[1025];
- memset(body,0,1025);
+ memset(body, '\0', sizeof(body));
buffer = buffer_init(1025);
while(ap_get_client_block(r, body, 1024)) {
buffer_add( buffer, body );
- memset(body,0,1025);
+ memset(body, '\0', sizeof(body));
}
if(arg && arg[0]) {
Modified: trunk/Open-ILS/src/apachemods/mod_xmlbuilder.c
===================================================================
--- trunk/Open-ILS/src/apachemods/mod_xmlbuilder.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/apachemods/mod_xmlbuilder.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -245,7 +245,7 @@
if(href[0] != '/') {
int len = strlen(ctx->xmlFile) + strlen(href) + 1;
char buf[len];
- bzero(buf, len);
+ memset( buf, '\0', sizeof(len) );
strcpy( buf, ctx->xmlFile );
int i;
for( i = strlen(buf); i != 0; i-- ) {
@@ -300,7 +300,7 @@
if( prop[0] == '&' && prop[nl-1] == ';' ) { /* replace the entity if we are one */
char buf[nl+1];
- bzero(buf, nl+1);
+ memset( buf, '\0', sizeof(buf) );
strncat(buf, prop + 1, nl - 2);
xmlEntityPtr ent = osrfHashGet( ctx->entHash, buf );
if(ent && ent->content) _prop = ent->content;
@@ -392,8 +392,8 @@
/* determine the path to the DTD file and load it */
int len = strlen(context->config->baseDir) + strlen(locale) + strlen(sysId) + 4;
- char buf[len]; bzero(buf,len);
- snprintf( buf, len, "%s/%s/%s", context->config->baseDir, locale, sysId );
+ char buf[len];
+ snprintf( buf, sizeof(buf), "%s/%s/%s", context->config->baseDir, locale, sysId );
xmlDtdPtr dtd = xmlParseDTD(NULL, buf);
if(!dtd) return;
Modified: trunk/Open-ILS/src/apachemods/mod_xmlent.c
===================================================================
--- trunk/Open-ILS/src/apachemods/mod_xmlent.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/apachemods/mod_xmlent.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -202,7 +202,7 @@
static void XMLCALL charHandler( void* userData, const XML_Char* s, int len ) {
ap_filter_t* filter = (ap_filter_t*) userData;
char data[len+1];
- bzero(data, len+1);
+ memset( data, '\0', sizeof(data) );
memcpy( data, s, len );
xmlEntConfig* config = ap_get_module_config(
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -2970,7 +2970,7 @@
case DBI_TYPE_DATETIME :
- memset(dt_string, '\0', 256);
+ memset(dt_string, '\0', sizeof(dt_string));
memset(&gmdt, '\0', sizeof(gmdt));
memset(&_tmp_dt, '\0', sizeof(_tmp_dt));
@@ -3049,7 +3049,7 @@
case DBI_TYPE_DATETIME :
- memset(dt_string, '\0', 256);
+ memset(dt_string, '\0', sizeof(dt_string));
memset(&gmdt, '\0', sizeof(gmdt));
memset(&_tmp_dt, '\0', sizeof(_tmp_dt));
Modified: trunk/Open-ILS/src/c-apps/oils_event.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_event.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/c-apps/oils_event.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -86,8 +86,8 @@
jsonObjectSetKey( json, "pid", jsonNewNumberObject(getpid()) );
char buf[256];
- memset(buf,0, 256);
- snprintf(buf, 256, "%s:%d", event->file, event->line);
+ memset(buf, '\0', sizeof(buf));
+ snprintf(buf, sizeof(buf), "%s:%d", event->file, event->line);
jsonObjectSetKey( json, "stacktrace", jsonNewObject(buf) );
if(event->perm) jsonObjectSetKey( json, "ilsperm", jsonNewObject(event->perm) );
Modified: trunk/Open-ILS/src/c-apps/oils_fetch.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_fetch.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/c-apps/oils_fetch.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -50,8 +50,7 @@
osrfHashSet( fmClassMap, hint, apiname );
char method[256];
- bzero(method, 256);
- snprintf(method, 256, "open-ils.fetch.%s.retrieve", apiname);
+ snprintf(method, sizeof(method), "open-ils.fetch.%s.retrieve", apiname);
osrfAppRegisterMethod( MODULENAME,
method, "oilsFetchDoRetrieve", "", 1, 0 );
@@ -129,13 +128,11 @@
/* construct the SQL */
char sql[256];
- bzero(sql, 256);
- snprintf( sql, 255, "select * from %s.%s where id = %s;", schema, object, id );
+ snprintf( sql, sizeof(sql), "select * from %s.%s where id = %s;", schema, object, id );
/* find the object hint from the api name */
char hintbuf[256];
- bzero(hintbuf,256);
- snprintf(hintbuf, 255, "%s.%s", schema, object );
+ snprintf(hintbuf, sizeof(hintbuf), "%s.%s", schema, object );
char* hint = osrfHashGet( fmClassMap, hintbuf );
osrfLogDebug(OSRF_LOG_MARK, "%s SQL = %s", MODULENAME, sql);
Modified: trunk/Open-ILS/src/c-apps/oils_utils.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_utils.c 2007-09-28 18:52:13 UTC (rev 7851)
+++ trunk/Open-ILS/src/c-apps/oils_utils.c 2007-09-30 18:47:04 UTC (rev 7852)
@@ -189,8 +189,7 @@
char* seed = jsonObjectGetString(o);
char* passhash = md5sum(passwd);
char buf[256];
- bzero(buf, 256);
- snprintf(buf, 255, "%s%s", seed, passhash);
+ snprintf(buf, sizeof(buf), "%s%s", seed, passhash);
char* fullhash = md5sum(buf);
jsonObjectFree(o);
More information about the open-ils-commits
mailing list