From: scottmk Date: Mon, 5 Oct 2009 18:53:02 +0000 (+0000) Subject: Small performance tweak. X-Git-Tag: osrf_rel_2_0_1~278 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=dacfb1cffe6960a41bca6ef9915a40b958ba2b98;p=OpenSRF.git Small performance tweak. Replaced two occurrences of jsonParseString( "[]" ) with the equivalant (and faster) call to jsonNewObject( JSON_ARRAY ). M src/libopensrf/osrf_application.c M src/srfsh/srfsh.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1808 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libopensrf/osrf_application.c b/src/libopensrf/osrf_application.c index d25eeec..cd94343 100644 --- a/src/libopensrf/osrf_application.c +++ b/src/libopensrf/osrf_application.c @@ -333,8 +333,8 @@ static int _osrfAppRespond( osrfMethodContext* ctx, const jsonObject* data, int osrfLogDebug( OSRF_LOG_MARK, "Adding responses to stash for atomic method %s", ctx->method->name ); - if( ctx->responses == NULL ) - ctx->responses = jsonParseString("[]"); + if( ctx->responses == NULL ) + ctx->responses = jsonNewObjectType( JSON_ARRAY ); if ( data != NULL ) jsonObjectPush( ctx->responses, jsonObjectClone(data) ); diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index a1badf2..04b7fc2 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -1021,7 +1021,7 @@ static int do_math( int count, int style ) { osrfAppSession* session = osrfAppSessionClientInit( "opensrf.math" ); osrfAppSessionConnect(session); - jsonObject* params = jsonParseString("[]"); + jsonObject* params = jsonNewObjectType( JSON_ARRAY ); jsonObjectPush(params,jsonNewObject("1")); jsonObjectPush(params,jsonNewObject("2"));