[open-ils-commits] r15025 - in trunk/Open-ILS/src: c-apps extras (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 25 11:49:16 EST 2009
Author: scottmk
Date: 2009-11-25 11:49:13 -0500 (Wed, 25 Nov 2009)
New Revision: 15025
Modified:
trunk/Open-ILS/src/c-apps/oils_auth.c
trunk/Open-ILS/src/c-apps/oils_cstore.c
trunk/Open-ILS/src/c-apps/oils_dataloader.c
trunk/Open-ILS/src/c-apps/oils_utils.c
trunk/Open-ILS/src/extras/oils_requestor.c
Log:
Replace all calls to the old JSON parser with calls
to the new one.
M Open-ILS/src/c-apps/oils_cstore.c
M Open-ILS/src/c-apps/oils_dataloader.c
M Open-ILS/src/c-apps/oils_utils.c
M Open-ILS/src/c-apps/oils_auth.c
M Open-ILS/src/extras/oils_requestor.c
Modified: trunk/Open-ILS/src/c-apps/oils_auth.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_auth.c 2009-11-25 14:32:24 UTC (rev 15024)
+++ trunk/Open-ILS/src/c-apps/oils_auth.c 2009-11-25 16:49:13 UTC (rev 15025)
@@ -299,13 +299,13 @@
"successful login: username=%s, authtoken=%s, workstation=%s", uname, authToken, ws );
oilsFMSetString( userObj, "passwd", "" );
- jsonObject* cacheObj = jsonParseStringFmt("{\"authtime\": %f}", timeout);
+ jsonObject* cacheObj = jsonParseFmt("{\"authtime\": %f}", timeout);
jsonObjectSetKey( cacheObj, "userobj", jsonObjectClone(userObj));
osrfCachePutObject( authKey, cacheObj, timeout );
jsonObjectFree(cacheObj);
osrfLogInternal(OSRF_LOG_MARK, "oilsAuthHandleLoginOK(): Placed user object into cache");
- jsonObject* payload = jsonParseStringFmt(
+ jsonObject* payload = jsonParseFmt(
"{ \"authtoken\": \"%s\", \"authtime\": %f }", authToken, timeout );
response = oilsNewEvent2( OSRF_LOG_MARK, OILS_EVENT_SUCCESS, payload );
@@ -340,7 +340,7 @@
if(!barcode) return NULL;
osrfLogDebug(OSRF_LOG_MARK, "Checking to see if barcode %s is active", barcode);
- jsonObject* params = jsonParseStringFmt("{\"barcode\":\"%s\"}", barcode);
+ jsonObject* params = jsonParseFmt("{\"barcode\":\"%s\"}", barcode);
jsonObject* card = oilsUtilsQuickReq(
"open-ils.cstore", "open-ils.cstore.direct.actor.card.search", params );
jsonObjectFree(params);
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2009-11-25 14:32:24 UTC (rev 15024)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2009-11-25 16:49:13 UTC (rev 15025)
@@ -1393,11 +1393,11 @@
Utility function: create a JSON_HASH with a single key/value pair.
This function is equivalent to:
- jsonParseStringFmt( "{\"%s\":\"%s\"}", key, value )
+ jsonParseFmt( "{\"%s\":\"%s\"}", key, value )
or, if value is NULL:
- jsonParseStringFmt( "{\"%s\":null}", key )
+ jsonParseFmt( "{\"%s\":null}", key )
...but faster because it doesn't create and parse a JSON string.
*/
Modified: trunk/Open-ILS/src/c-apps/oils_dataloader.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_dataloader.c 2009-11-25 14:32:24 UTC (rev 15024)
+++ trunk/Open-ILS/src/c-apps/oils_dataloader.c 2009-11-25 16:49:13 UTC (rev 15025)
@@ -211,7 +211,7 @@
static int sendCommand ( const char* json ) {
int ret = 1;
- jsonObject* item = jsonParseString(json);
+ jsonObject* item = jsonParse(json);
if (!item->classname) {
osrfLogError(OSRF_LOG_MARK, "Data loader cannot handle unclassed objects. Skipping [%s]!", json);
@@ -226,7 +226,7 @@
// make the param array
jsonObject* params = jsonNewObjectType( JSON_ARRAY );
jsonObjectSetIndex( params, 0, item );
- jsonObjectSetIndex( params, 1, jsonParseString("{\"quiet\":\"true\"}") );
+ jsonObjectSetIndex( params, 1, jsonParse("{\"quiet\":\"true\"}") );
jsonObject* data;
int req_id = osrfAppSessionMakeRequest( session, params, method_name, 1, NULL );
Modified: trunk/Open-ILS/src/c-apps/oils_utils.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_utils.c 2009-11-25 14:32:24 UTC (rev 15024)
+++ trunk/Open-ILS/src/c-apps/oils_utils.c 2009-11-25 16:49:13 UTC (rev 15025)
@@ -79,7 +79,7 @@
oilsEvent* evt = NULL;
if (orgid == -1) {
- jsonObject* where_clause = jsonParseString( "{\"parent_ou\":null}" );
+ jsonObject* where_clause = jsonParse( "{\"parent_ou\":null}" );
jsonObject* org = oilsUtilsQuickReq(
"open-ils.cstore",
"open-ils.cstore.direct.actor.org_unit.search",
@@ -95,7 +95,7 @@
for( i = 0; i < size && permissions[i]; i++ ) {
char* perm = permissions[i];
- jsonObject* params = jsonParseStringFmt("[%d, \"%s\", %d]", userid, perm, orgid);
+ jsonObject* params = jsonParseFmt("[%d, \"%s\", %d]", userid, perm, orgid);
jsonObject* o = oilsUtilsQuickReq( "open-ils.storage",
"open-ils.storage.permission.user_has_perm", params );
@@ -139,7 +139,7 @@
jsonObject* oilsUtilsFetchUserByUsername( const char* name ) {
if(!name) return NULL;
- jsonObject* params = jsonParseStringFmt("{\"usrname\":\"%s\"}", name);
+ jsonObject* params = jsonParseFmt("{\"usrname\":\"%s\"}", name);
jsonObject* user = oilsUtilsQuickReq(
"open-ils.cstore", "open-ils.cstore.direct.actor.user.search", params );
@@ -154,7 +154,7 @@
osrfLogInfo(OSRF_LOG_MARK, "Fetching user by barcode %s", barcode);
- jsonObject* params = jsonParseStringFmt("{\"barcode\":\"%s\"}", barcode);
+ jsonObject* params = jsonParseFmt("{\"barcode\":\"%s\"}", barcode);
jsonObject* card = oilsUtilsQuickReq(
"open-ils.cstore", "open-ils.cstore.direct.actor.card.search", params );
jsonObjectFree(params);
@@ -167,7 +167,7 @@
double iusr = strtod(usr, NULL);
free(usr);
- params = jsonParseStringFmt("[%f]", iusr);
+ params = jsonParseFmt("[%f]", iusr);
jsonObject* user = oilsUtilsQuickReq(
"open-ils.cstore", "open-ils.cstore.direct.actor.user.retrieve", params);
@@ -178,7 +178,7 @@
char* oilsUtilsFetchOrgSetting( int orgid, const char* setting ) {
if(!setting) return NULL;
- jsonObject* params = jsonParseStringFmt("[%d, \"%s\"]", orgid, setting );
+ jsonObject* params = jsonParseFmt("[%d, \"%s\"]", orgid, setting );
jsonObject* set = oilsUtilsQuickReq(
"open-ils.actor",
@@ -199,7 +199,7 @@
osrfLogDebug(OSRF_LOG_MARK, "Logging in with username %s", uname );
char* token = NULL;
- jsonObject* params = jsonParseStringFmt("[\"%s\"]", uname);
+ jsonObject* params = jsonParseFmt("[\"%s\"]", uname);
jsonObject* o = oilsUtilsQuickReq(
"open-ils.auth", "open-ils.auth.authenticate.init", params );
@@ -214,7 +214,7 @@
jsonObjectFree(params);
free(passhash);
- params = jsonParseStringFmt( "[\"%s\", \"%s\", \"%s\", \"%d\"]", uname, fullhash, type, orgId );
+ params = jsonParseFmt( "[\"%s\", \"%s\", \"%s\", \"%d\"]", uname, fullhash, type, orgId );
o = oilsUtilsQuickReq( "open-ils.auth",
"open-ils.auth.authenticate.complete", params );
@@ -233,7 +233,7 @@
jsonObject* oilsUtilsFetchWorkstation( long id ) {
- jsonObject* p = jsonParseStringFmt("[%ld]", id);
+ jsonObject* p = jsonParseFmt("[%ld]", id);
jsonObject* r = oilsUtilsQuickReq(
"open-ils.storage",
"open-ils.storage.direct.actor.workstation.retrieve", p );
@@ -242,7 +242,7 @@
}
jsonObject* oilsUtilsFetchWorkstationByName( const char* name ) {
- jsonObject* p = jsonParseStringFmt("{\"name\":\"%s\"}", name);
+ jsonObject* p = jsonParseFmt("{\"name\":\"%s\"}", name);
jsonObject* r = oilsUtilsCStoreReq(
"open-ils.cstore.direct.actor.workstation.search", p);
jsonObjectFree(p);
Modified: trunk/Open-ILS/src/extras/oils_requestor.c
===================================================================
--- trunk/Open-ILS/src/extras/oils_requestor.c 2009-11-25 14:32:24 UTC (rev 15024)
+++ trunk/Open-ILS/src/extras/oils_requestor.c 2009-11-25 16:49:13 UTC (rev 15025)
@@ -107,7 +107,7 @@
if( *tmp ) {
growing_buffer* buffer = buffer_init(256);
buffer_fadd( buffer, "[%s]", tmp );
- params = jsonParseString( buffer->buf );
+ params = jsonParse( buffer->buf );
buffer_free(buffer);
}
More information about the open-ils-commits
mailing list