Skip to content
Snippets Groups Projects
Commit 715e333b authored by Jakob Olsson's avatar Jakob Olsson
Browse files

comment out schema debug prints till proper debug logger implemented

parent 790de07c
Branches
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ struct schema_context s_ctx;
static void schema_flush_method(struct schema_method *s_method)
{
fprintf(stderr, "cleaning method %s\n", (char *)s_method->avl.key);
//fprintf(stderr, "cleaning method %s\n", (char *)s_method->avl.key);
if (s_method->b_input)
free(s_method->b_input);
......@@ -37,7 +37,7 @@ static void schema_flush_methods(struct schema_object *s_object)
{
struct schema_method *s_method, *tmp;
fprintf(stderr, "flushing all methods of object %s\n", (char *)s_object->avl.key);
//fprintf(stderr, "flushing all methods of object %s\n", (char *)s_object->avl.key);
avl_for_each_element_safe(&s_object->schema_methods, s_method, avl, tmp) {
avl_delete(&s_object->schema_methods, &s_method->avl);
......@@ -49,7 +49,7 @@ static void schema_flush_methods(struct schema_object *s_object)
static void schema_flush_object(struct schema_object *s_object)
{
fprintf(stderr, "cleaning object %s\n", (char *)s_object->avl.key);
//fprintf(stderr, "cleaning object %s\n", (char *)s_object->avl.key);
schema_flush_methods(s_object);
free((void *)s_object->avl.key);
......@@ -68,7 +68,7 @@ void schema_flush_objects(void)
{
struct schema_object *s_object, *tmp;
fprintf(stderr, "cleaning all schema objects\n");
//fprintf(stderr, "cleaning all schema objects\n");
avl_for_each_element_safe(&s_ctx.schema_objects, s_object, avl, tmp) {
avl_delete(&s_ctx.schema_objects, &s_object->avl);
......@@ -87,7 +87,7 @@ static void schema_parse_object(struct schema_object *schema_object, struct blob
if (strncmp(blobmsg_name(properties), "properties", 11))
continue;
//fprintf(stderr, "%s %d method name = %s\n", __func__, __LINE__, blobmsg_name(object));
////fprintf(stderr, "%s %d method name = %s\n", __func__, __LINE__, blobmsg_name(object));
s_method = (struct schema_method *)calloc(1, sizeof(*s_method));
if (!s_method)
continue;
......@@ -96,14 +96,14 @@ static void schema_parse_object(struct schema_object *schema_object, struct blob
avl_insert(&schema_object->schema_methods, &s_method->avl);
blobmsg_for_each_attr(method, properties, rem2) {
//fprintf(stderr, "%s %d name = %s\n", __func__, __LINE__, blobmsg_name(method));
////fprintf(stderr, "%s %d name = %s\n", __func__, __LINE__, blobmsg_name(method));
if (!strncmp(blobmsg_name(method), "input", 6)) {
int len = blob_raw_len(method);
s_method->b_input = (struct blob_attr *) calloc(1, sizeof(struct blob_attr) + len);
memcpy(s_method->b_input, method, len);
fprintf(stderr, "b_input = %s\n", blobmsg_format_json(s_method->b_input, true));
//fprintf(stderr, "b_input = %s\n", blobmsg_format_json(s_method->b_input, true));
}
else if (!strncmp(blobmsg_name(method), "output", 7)) {
int len = blob_raw_len(method);
......@@ -111,7 +111,7 @@ static void schema_parse_object(struct schema_object *schema_object, struct blob
s_method->b_output = (struct blob_attr *) calloc(1, sizeof(struct blob_attr) + len);
memcpy(s_method->b_output, method, len);
fprintf(stderr, "b_output = %s\n", blobmsg_format_json(s_method->b_output, true));
//fprintf(stderr, "b_output = %s\n", blobmsg_format_json(s_method->b_output, true));
}
}
}
......@@ -130,7 +130,7 @@ schema_setup_file(const char *path)
blob_buf_init(&acl, 0);
if (!blobmsg_add_json_from_file(&acl, path)) {
fprintf(stderr, "Failed to parse %s\n", path);
//fprintf(stderr, "Failed to parse %s\n", path);
goto out;
}
......@@ -144,7 +144,7 @@ schema_setup_file(const char *path)
blob_for_each_attr(root, acl.head, rem) {
if (!strncmp(blobmsg_name(root), "regex", 6)) {
schema_object->regex = blobmsg_get_bool(root);
fprintf(stderr, "%s: regex enabled %d\n", __func__, schema_object->regex);
//fprintf(stderr, "%s: regex enabled %d\n", __func__, schema_object->regex);
}
......@@ -166,16 +166,16 @@ schema_setup_file(const char *path)
continue;
schema_parse_object(schema_object, object);
fprintf(stderr, "added schema %s\n", schema_object->object_name);
//fprintf(stderr, "added schema %s\n", schema_object->object_name);
}
}
if (schema_object->regex) {
int rv;
fprintf(stderr, "parsing regex for %s!\n", (char *)schema_object->avl.key );
//fprintf(stderr, "parsing regex for %s!\n", (char *)schema_object->avl.key );
rv = regcomp(&schema_object->regex_exp, (char *) schema_object->avl.key, 0);
if (rv) {
fprintf(stderr, "%s: invalid regex: %s, flushing validation schema!\n", __func__, (char *) schema_object->avl.key);
//fprintf(stderr, "%s: invalid regex: %s, flushing validation schema!\n", __func__, (char *) schema_object->avl.key);
goto out_flush;
}
}
......@@ -198,14 +198,14 @@ struct schema_method *schema_get_method_schema(const char *object, const char *m
struct schema_object *s_object;
struct schema_method *s_method;
fprintf(stderr, "%s: object = %s method = %s\n", __func__, object, method);
//fprintf(stderr, "%s: object = %s method = %s\n", __func__, object, method);
s_object = schema_get_object_schema(object);
if (!s_object)
return NULL;
avl_for_each_element(&s_object->schema_methods, s_method, avl) {
fprintf(stderr, "%s: method = %s, avl.key = %s\n", __func__, method, (char *)s_method->avl.key);
//fprintf(stderr, "%s: method = %s, avl.key = %s\n", __func__, method, (char *)s_method->avl.key);
if (!strncmp(method, (char *) s_method->avl.key, METHOD_NAME_MAX_LEN))
return s_method;
}
......@@ -227,10 +227,10 @@ struct schema_object *schema_get_object_schema(const char *object)
{
struct schema_object *s_object;
fprintf(stderr, "%s: object = %s\n", __func__, object);
//fprintf(stderr, "%s: object = %s\n", __func__, object);
avl_for_each_element(&s_ctx.schema_objects, s_object, avl) {
fprintf(stderr, "%s: object = %s, avl.key = %s, regex = %d\n", __func__, object, (char *)s_object->avl.key, s_object->regex);
//fprintf(stderr, "%s: object = %s, avl.key = %s, regex = %d\n", __func__, object, (char *)s_object->avl.key, s_object->regex);
if (s_object->regex) {
if (!regexec(&s_object->regex_exp, object, 0, NULL, 0))
return s_object;
......@@ -255,7 +255,7 @@ schema_setup_json(void)
return;
for (i = 0; i < gl.gl_pathc; i++) {
fprintf(stderr, "path = %s\n", gl.gl_pathv[i]);
//fprintf(stderr, "path = %s\n", gl.gl_pathv[i]);
schema_setup_file(gl.gl_pathv[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment