Skip to content

Commit

Permalink
json_object_set_boolean for upstream style check
Browse files Browse the repository at this point in the history
  • Loading branch information
Stoian Ivanov committed Sep 20, 2016
1 parent 9f9c332 commit fae0945
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions json_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ json_bool json_object_get_boolean(const struct json_object *jso)
}
}

json_bool json_object_set_boolean(struct json_object *jso,json_bool new_value){
if (!jso || jso->o_type!=json_type_boolean)
return FALSE;
jso->o.c_boolean=new_value;
return TRUE;
}


/* json_object_int */

Expand Down
13 changes: 13 additions & 0 deletions json_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,19 @@ extern struct json_object* json_object_new_boolean(json_bool b);
extern json_bool json_object_get_boolean(const struct json_object *obj);


/** Set the json_bool value of a json_object
*
* The type of obj is checked to be a json_type_boolean and FALSE is returned
* if it is not without any further actions. If type of obj is json_type_boolean
* the obect value is chaned to new_value
*
* @param obj the json_object instance
* @param new_value the value to be set
* @returns TRUE if value is set correctly
*/
extern json_bool json_object_set_boolean(struct json_object *obj,json_bool new_value);


/* int type methods */

/** Create a new empty json_object of type json_type_int
Expand Down

0 comments on commit fae0945

Please sign in to comment.