Fedora 30 packaging fix issu
[src/app-framework-binder.git] / src / afb-trace.c
index aaa1635..c750aca 100644 (file)
@@ -65,7 +65,7 @@
 /* struct for tags */
 struct tag {
        struct tag *next;       /* link to the next */
-       char tag[1];            /* name of the tag */
+       char tag[];             /* name of the tag */
 };
 
 /* struct for events */
@@ -148,18 +148,8 @@ static void ctxt_error(char **errors, const char *format, ...)
 /* timestamp */
 static struct json_object *timestamp(const struct afb_hookid *hookid)
 {
-#if JSON_C_MAJOR_VERSION > 0 || JSON_C_MINOR_VERSION >= 12
-       char ts[50];
-
-       snprintf(ts, sizeof ts, "%llu.%06lu",
-                       (long long unsigned)hookid->time.tv_sec,
-                       (long unsigned)((hookid->time.tv_nsec + 500) / 1000));
-
-       return json_object_new_double_s(0.0f, ts); /* the real value isn't used */
-#else
        return json_object_new_double((double)hookid->time.tv_sec +
                        (double)hookid->time.tv_nsec * .000000001);
-#endif
 }
 
 /* verbosity level name or NULL */
@@ -1081,7 +1071,7 @@ static struct tag *trace_get_tag(struct afb_trace *trace, const char *name, int
 
        if (!tag && alloc) {
                /* creation if needed */
-               tag = malloc(sizeof * tag + strlen(name));
+               tag = malloc(sizeof * tag + 1 + strlen(name));
                if (tag) {
                        strcpy(tag->tag, name);
                        tag->next = trace->tags;