Small performance tweak.
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 5 Oct 2009 18:53:02 +0000 (18:53 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 5 Oct 2009 18:53:02 +0000 (18:53 +0000)
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

src/libopensrf/osrf_application.c
src/srfsh/srfsh.c

index d25eeec..cd94343 100644 (file)
@@ -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) );        
index a1badf2..04b7fc2 100644 (file)
@@ -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"));