summaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
commit28bf37132d86cc59320e21d843960d086cef664c (patch)
treebf085b5f89f1d1061b6a88ecc66c50721b13d86c /json.c
parentecb7e1ff3ec73000918c56861c55258c2d4deada (diff)
downloadgpsd-28bf37132d86cc59320e21d843960d086cef664c.tar.gz
Retire splint from our set of static analyzers.
The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
Diffstat (limited to 'json.c')
-rw-r--r--json.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/json.c b/json.c
index 229f3d1a..979709ad 100644
--- a/json.c
+++ b/json.c
@@ -108,12 +108,10 @@ static void json_trace(int errlevel, const char *fmt, ...)
# define json_debug_trace(args) (void) json_trace args
#else
-# define json_debug_trace(args) /*@i1@*/do { } while (0)
+# define json_debug_trace(args) do { } while (0)
#endif /* CLIENTDEBUG_ENABLE */
-/*@-immediatetrans -dependenttrans -usereleased -compdef@*/
-static /*@null@*/ char *json_target_address(const struct json_attr_t *cursor,
- /*@null@*/
+static char *json_target_address(const struct json_attr_t *cursor,
const struct json_array_t
*parent, int offset)
{
@@ -157,16 +155,13 @@ static /*@null@*/ char *json_target_address(const struct json_attr_t *cursor,
return targetaddr;
}
-/*@-immediatetrans -dependenttrans +usereleased +compdef@*/
static int json_internal_read_object(const char *cp,
const struct json_attr_t *attrs,
- /*@null@*/
const struct json_array_t *parent,
int offset,
- /*@null@*/ const char **end)
+ const char **end)
{
- /*@ -nullstate -nullderef -mustfreefresh -nullpass -usedef @*/
enum
{ init, await_attr, in_attr, await_value, in_val_string,
in_escape, in_val_token, post_val, post_array
@@ -187,12 +182,6 @@ static int json_internal_read_object(const char *cp,
const struct json_enum_t *mp;
char *lptr;
-#ifdef S_SPLINT_S
- /* prevents gripes about buffers not being completely defined */
- memset(valbuf, '\0', sizeof(valbuf));
- memset(attrbuf, '\0', sizeof(attrbuf));
-#endif /* S_SPLINT_S */
-
if (end != NULL)
*end = NULL; /* give it a well-defined value on parse failure */
@@ -536,7 +525,6 @@ static int json_internal_read_object(const char *cp,
}
break;
}
- /*@fallthrough@*/
case post_array:
if (isspace((unsigned char) *cp))
continue;
@@ -565,13 +553,11 @@ static int json_internal_read_object(const char *cp,
*end = cp;
json_debug_trace((1, "JSON parse ends.\n"));
return 0;
- /*@ +nullstate +nullderef +mustfreefresh +nullpass +usedef @*/
}
int json_read_array(const char *cp, const struct json_array_t *arr,
const char **end)
{
- /*@-nullstate -onlytrans@*/
int substatus, offset, arrcount;
char *tp;
@@ -728,16 +714,13 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
*(arr->count) = arrcount;
if (end != NULL)
*end = cp;
- /*@ -nullderef @*/
json_debug_trace((1, "leaving json_read_array() with %d elements\n",
arrcount));
- /*@ +nullderef @*/
return 0;
- /*@+nullstate +onlytrans@*/
}
int json_read_object(const char *cp, const struct json_attr_t *attrs,
- /*@null@*/ const char **end)
+ const char **end)
{
int st;
@@ -746,7 +729,7 @@ int json_read_object(const char *cp, const struct json_attr_t *attrs,
return st;
}
-const /*@observer@*/ char *json_error_string(int err)
+const char *json_error_string(int err)
{
const char *errors[] = {
"unknown error while parsing JSON",