return true;
}
-static bool add_u64_value(json_object *jobject, const char *desc,
+static bool add_u64_value(json_object *jobj, const char *desc,
const uint8_t u64[8])
{
json_object *jstring;
if (!jstring)
return false;
- json_object_object_add(jobject, desc, jstring);
+ json_object_object_del(jobj, desc);
+ json_object_object_add(jobj, desc, jstring);
return true;
}
-static bool add_key_value(json_object *jobject, const char *desc,
+static bool add_key_value(json_object *jobj, const char *desc,
const uint8_t key[16])
{
json_object *jstring;
if (!jstring)
return false;
- json_object_object_add(jobject, desc, jstring);
+ json_object_object_del(jobj, desc);
+ json_object_object_add(jobj, desc, jstring);
return true;
}
if (!jstring)
return false;
+ json_object_object_del(jobj, desc);
json_object_object_add(jobj, desc, jstring);
return true;
}
if (!jstring)
return false;
+ json_object_object_del(jobj, desc);
json_object_object_add(jobj, desc, jstring);
return true;
}
-static bool write_int(json_object *jobj, const char *keyword, int val)
+static bool write_int(json_object *jobj, const char *desc, int val)
{
json_object *jvalue;
- json_object_object_del(jobj, keyword);
-
jvalue = json_object_new_int(val);
if (!jvalue)
return false;
- json_object_object_add(jobj, keyword, jvalue);
+ json_object_object_del(jobj, desc);
+ json_object_object_add(jobj, desc, jvalue);
return true;
}
}
}
-static bool write_mode(json_object *jobj, const char *keyword, int value)
+static bool write_mode(json_object *jobj, const char *desc, int value)
{
json_object *jstring;
if (!jstring)
return false;
- json_object_object_add(jobj, keyword, jstring);
+ json_object_object_del(jobj, desc);
+ json_object_object_add(jobj, desc, jstring);
return true;
}