diff mbox series

[LEDE-DEV] handler: replace is_error() helper with NULL check

Message ID 20171208141923.18780-1-ardeleanalex@gmail.com
State Rejected
Headers show
Series [LEDE-DEV] handler: replace is_error() helper with NULL check | expand

Commit Message

Alexandru Ardelean Dec. 8, 2017, 2:19 p.m. UTC
The `is_error()` is just a macro that checks
that object is NULL (which is considered an error
in libjson-c terminology).

Newer libjson-c versions have deprecated this.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 handler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandru Ardelean Dec. 8, 2017, 2:20 p.m. UTC | #1
On Fri, Dec 8, 2017 at 4:19 PM, Alexandru Ardelean
<ardeleanalex@gmail.com> wrote:
> The `is_error()` is just a macro that checks
> that object is NULL (which is considered an error
> in libjson-c terminology).
>
> Newer libjson-c versions have deprecated this.

I forgot to add the [netifd] tag.

>
> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> ---
>  handler.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/handler.c b/handler.c
> index 0c4627f..a0b2a57 100644
> --- a/handler.c
> +++ b/handler.c
> @@ -105,7 +105,7 @@ netifd_parse_script_handler(const char *name, script_dump_cb cb)
>                         tok = json_tokener_new();
>
>                 obj = json_tokener_parse_ex(tok, start, len);
> -               if (!is_error(obj)) {
> +               if (obj) {
>                         netifd_init_script_handler(name, obj, cb);
>                         json_object_put(obj);
>                         json_tokener_free(tok);
> --
> 2.11.0
>
diff mbox series

Patch

diff --git a/handler.c b/handler.c
index 0c4627f..a0b2a57 100644
--- a/handler.c
+++ b/handler.c
@@ -105,7 +105,7 @@  netifd_parse_script_handler(const char *name, script_dump_cb cb)
 			tok = json_tokener_new();
 
 		obj = json_tokener_parse_ex(tok, start, len);
-		if (!is_error(obj)) {
+		if (obj) {
 			netifd_init_script_handler(name, obj, cb);
 			json_object_put(obj);
 			json_tokener_free(tok);