Skip to content

Commit

Permalink
Rename json_pair_make to json_pair_alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed May 22, 2018
1 parent 66107c7 commit 0fe200a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/modules/rlm_rest/rest.c
Expand Up @@ -226,11 +226,11 @@ typedef struct rest_custom_data {
/** Flags to control the conversion of JSON values to VALUE_PAIRs.
*
* These fields are set when parsing the expanded format for value pairs in
* JSON, and control how json_pair_make_leaf and json_pair_make convert the JSON
* JSON, and control how json_pair_alloc_leaf and json_pair_alloc convert the JSON
* value, and move the new VALUE_PAIR into an attribute list.
*
* @see json_pair_make
* @see json_pair_make_leaf
* @see json_pair_alloc
* @see json_pair_alloc_leaf
*/
typedef struct json_flags {
int do_xlat; //!< If true value will be expanded with xlat.
Expand Down Expand Up @@ -890,7 +890,7 @@ static int rest_decode_post(UNUSED rlm_rest_t const *instance, UNUSED rlm_rest_s
* - #VALUE_PAIR just created.
* - NULL on error.
*/
static VALUE_PAIR *json_pair_make_leaf(UNUSED rlm_rest_t const *instance, UNUSED rlm_rest_section_t const *section,
static VALUE_PAIR *json_pair_alloc_leaf(UNUSED rlm_rest_t const *instance, UNUSED rlm_rest_section_t const *section,
TALLOC_CTX *ctx, REQUEST *request,
fr_dict_attr_t const *da, json_flags_t *flags, json_object *leaf)
{
Expand Down Expand Up @@ -1027,7 +1027,7 @@ static VALUE_PAIR *json_pair_make_leaf(UNUSED rlm_rest_t const *instance, UNUSED
* - Number of attributes created.
* - < 0 on error.
*/
static int json_pair_make(rlm_rest_t const *instance, rlm_rest_section_t const *section,
static int json_pair_alloc(rlm_rest_t const *instance, rlm_rest_section_t const *section,
REQUEST *request, json_object *object, UNUSED int level, int max)
{
int max_attrs = max;
Expand Down Expand Up @@ -1139,7 +1139,7 @@ static int json_pair_make(rlm_rest_t const *instance, rlm_rest_section_t const *
}

/*
* Setup fr_pair_make / recursion loop.
* Setup fr_pair_alloc / recursion loop.
*/
if (!flags.is_json && fr_json_object_is_type(value, json_type_array)) {
elements = json_object_array_length(value);
Expand Down Expand Up @@ -1177,12 +1177,12 @@ static int json_pair_make(rlm_rest_t const *instance, rlm_rest_section_t const *
continue;

/*
vp = json_pair_make(instance, section,
vp = json_pair_alloc(instance, section,
request, value,
level + 1, max_attrs);*/
} else {
vp = json_pair_make_leaf(instance, section, ctx, request,
dst->tmpl_da, &flags, element);
vp = json_pair_alloc_leaf(instance, section, ctx, request,
dst->tmpl_da, &flags, element);
if (!vp) continue;
}
RDEBUG2("&%pP", vp);
Expand All @@ -1202,12 +1202,12 @@ static int json_pair_make(rlm_rest_t const *instance, rlm_rest_section_t const *
/** Converts JSON response into VALUE_PAIRs and adds them to the request.
*
* Converts the raw JSON string into a json-c object tree and passes it to
* json_pair_make. After the tree has been parsed json_object_put is called
* json_pair_alloc. After the tree has been parsed json_object_put is called
* which decrements the reference count of the root node by one, and frees
* the entire tree.
*
* @see rest_encode_json
* @see json_pair_make
* @see json_pair_alloc
*
* @param[in] instance configuration data.
* @param[in] section configuration data.
Expand Down Expand Up @@ -1240,7 +1240,7 @@ static int rest_decode_json(rlm_rest_t const *instance, rlm_rest_section_t const
return -1;
}

ret = json_pair_make(instance, section, request, json, 0, REST_BODY_MAX_ATTRS);
ret = json_pair_alloc(instance, section, request, json, 0, REST_BODY_MAX_ATTRS);

/*
* Decrement reference count for root object, should free entire JSON tree.
Expand Down

0 comments on commit 0fe200a

Please sign in to comment.