json2c: Fix a fatal warning 63/20563/1
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 12 Mar 2019 12:41:48 +0000 (13:41 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Tue, 12 Mar 2019 12:56:55 +0000 (13:56 +0100)
At the end, the case is never reached because
json_object_to_json_string_ext only produces
valid JSON strings and a string terminated by
'\' isn't a valid JSON string.

Change-Id: I58a6dc4d9c014487ff2dc85f7eb3dbf33ffea6b1
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/devtools/json2c.c

index 1bc20b0..9bb9e9b 100644 (file)
@@ -81,13 +81,13 @@ char *make_desc(struct json_object *o)
                }
                else if (c == '\\') {
                        switch ((c = *b++)) {
-                       case 0:
-                               b--;
-                               break;
                        case '/':
                                buf[0] = '/';
                                buf[1] = 0;
                                break;
+                       case 0:
+                               b--;
+                               /*@fallthrough@*/
                        default:
                                buf[0] = '\\';
                                buf[1] = c;