MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / store_serialize

Function store_serialize

modules/usrloc/kv_store.c:135–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133};
134
135str store_serialize(map_t _store)
136{
137 cJSON *flat_map;
138 str ret = STR_NULL;
139
140 if (map_size(_store) == 0)
141 return ret;
142
143 cJSON_InitHooks(&shm_hooks);
144
145 flat_map = cJSON_CreateObject();
146 if (!flat_map) {
147 LM_ERR("oom\n");
148 return ret;
149 }
150
151 if (map_for_each(_store, push_kv_to_json, flat_map) != 0)
152 LM_ERR("oom - serialized map is incomplete!\n");
153
154 ret.s = cJSON_PrintUnformatted(flat_map);
155 if (!ret.s) {
156 LM_ERR("oom\n");
157 goto out;
158 }
159 ret.len = strlen(ret.s);
160
161out:
162 cJSON_Delete(flat_map);
163 cJSON_InitHooks(NULL);
164 return ret;
165}
166
167void store_free_buffer(str *serialized)
168{

Callers 7

db_insert_ucontactFunction · 0.85
db_update_ucontactFunction · 0.85
mi_add_aor_nodeFunction · 0.85
bin_push_urecordFunction · 0.85
bin_push_contactFunction · 0.85
persist_urecord_kv_storeFunction · 0.85

Calls 6

map_sizeFunction · 0.85
map_for_eachFunction · 0.85
cJSON_InitHooksFunction · 0.50
cJSON_CreateObjectFunction · 0.50
cJSON_PrintUnformattedFunction · 0.50
cJSON_DeleteFunction · 0.50

Tested by

no test coverage detected