[sr-dev] [kamailio/kamailio] json: add get_object API and fix str init (5fe8618)

Daniel-Constantin Mierla notifications at github.com
Mon Jan 29 20:15:56 CET 2018


Looking at the code I think it is better to change the prototype of:

```
str _json_extract_field(struct json_object *json_obj, char *json_name)
```

to:

```
int _json_extract_field(struct json_object *json_obj, char *json_name, str *val)
```

Now it returns a variable declared on the stack, which could work with recent compilers, being returned by value. `str` itself is not a large structure, but returning structure values is not recommended in C, code analyzers complain about (same for passing a structure value as parameter -- it is recommended to use pointers).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/commit/5fe86186e2856ce5039c0133e1f53b62df2be485#commitcomment-27188215
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180129/f7f6732f/attachment.html>


More information about the sr-dev mailing list