Performance tweak to message handling.
In five locations in osrf_message.c, we were turning a jsonObject into
a JSON string, only to parse it again back into a jsonObject:
-- osrf_message_add_object_param()
-- osrfMessageToJSON() (two occurrences)
-- osrf_message_deserialize() (two occurrences)
That's silly.
This new version copies the original jsonObject directly, with no round
trip through a JSON string. We use jsonObjectDecodeClass() to do the
copy, in order to make sure that all class hints are decoded into
classnames.
(Until recently, jsonObjectDecodeClass() would remove classnames that were
already present. That's presumably the reason for the curious and
inefficient two-step procedure that we were using up till now.)
Also: In two locations (in osrf_message_add_object_param() and
osrf_message_add_param()) We used jsonParseString() to parse a
hard-coded "[]". I replaced those calls with equivalent (and faster)
calls to jsonNewObjectType( JSON_ARRAY );
Also: in osrf_message_set_result_content() I eliminated a pointless test
for nullity of the json_string variable. An earlier test already
guarantees that json_string is not NULL.
M src/libopensrf/osrf_message.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1807
9efc2488-bf62-4759-914b-
345cdb29e865