clang-format the files

This commit is contained in:
dota17
2020-03-28 10:25:00 +08:00
parent c117d8a8a8
commit 8b162c4b89
54 changed files with 2860 additions and 2713 deletions

View File

@@ -5,7 +5,8 @@
#include "json.h"
#include "printbuf.h"
struct myinfo {
struct myinfo
{
int value;
};
@@ -17,10 +18,7 @@ static void freeit(json_object *jso, void *userdata)
// Don't actually free anything here, the userdata is stack allocated.
freeit_was_called = 1;
}
static int custom_serializer(struct json_object *o,
struct printbuf *pb,
int level,
int flags)
static int custom_serializer(struct json_object *o, struct printbuf *pb, int level, int flags)
{
sprintbuf(pb, "Custom Output");
return 0;
@@ -39,10 +37,11 @@ int main(int argc, char **argv)
printf("my_object.to_string(standard)=%s\n", json_object_to_json_string(my_object));
struct myinfo userdata = { .value = 123 };
struct myinfo userdata = {.value = 123};
json_object_set_serializer(my_object, custom_serializer, &userdata, freeit);
printf("my_object.to_string(custom serializer)=%s\n", json_object_to_json_string(my_object));
printf("my_object.to_string(custom serializer)=%s\n",
json_object_to_json_string(my_object));
printf("Next line of output should be from the custom freeit function:\n");
freeit_was_called = 0;
@@ -60,7 +59,8 @@ int main(int argc, char **argv)
json_object_set_serializer(my_object, custom_serializer, &userdata, freeit);
json_object_get(my_object);
json_object_put(my_object);
printf("my_object.to_string(custom serializer)=%s\n", json_object_to_json_string(my_object));
printf("my_object.to_string(custom serializer)=%s\n",
json_object_to_json_string(my_object));
printf("Next line of output should be from the custom freeit function:\n");
freeit_was_called = 0;