]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Update json_object.c 694/head
authorihsinme <61293369+ihsinme@users.noreply.github.com>
Fri, 5 Feb 2021 15:58:20 +0000 (18:58 +0300)
committerGitHub <noreply@github.com>
Fri, 5 Feb 2021 15:58:20 +0000 (18:58 +0300)
json_object.c

index b42026b6817e97f6e3228a2971ad367cfdb52fd3..c15a477ba6b7da1b001325ff1960b8d03f6d37ed 100644 (file)
@@ -235,7 +235,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
                                break;
                        }
 
-                       if (pos - start_offset > 0)
+                       if (pos > start_offset)
                                printbuf_memappend(pb, str + start_offset, pos - start_offset);
 
                        if (c == '\b')
@@ -261,7 +261,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
                        if (c < ' ')
                        {
                                char sbuf[7];
-                               if (pos - start_offset > 0)
+                               if (pos > start_offset)
                                        printbuf_memappend(pb, str + start_offset,
                                                           pos - start_offset);
                                snprintf(sbuf, sizeof(sbuf), "\\u00%c%c", json_hex_chars[c >> 4],
@@ -273,7 +273,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
                                pos++;
                }
        }
-       if (pos - start_offset > 0)
+       if (pos > start_offset)
                printbuf_memappend(pb, str + start_offset, pos - start_offset);
        return 0;
 }