Content-Type: multipart/mixed; boundary="===============2211279542435435484==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 1/6] accel-config: Remove duplicated function Date: Fri, 07 May 2021 15:31:21 -0400 Message-ID: <20210507193126.841998-2-ramesh.thomas@intel.com> In-Reply-To: 20210507193126.841998-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============2211279542435435484== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas Function used to write to stdout can also be used to write to a file on disk because both are exactly same and take FILE * as argument Signed-off-by: Ramesh Thomas --- accfg/list.c | 2 +- util/json.c | 21 --------------------- util/json.h | 2 -- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/accfg/list.c b/accfg/list.c index 7e6ca6a..d03cf30 100644 --- a/accfg/list.c +++ b/accfg/list.c @@ -373,7 +373,7 @@ static int save_config(struct list_filter_arg *lfa, con= st char *saved_file) } = if (jdevices) - __util_display_json_array(fd, jdevices, lfa->flags); + util_display_json_array(fd, jdevices, lfa->flags); = /* free all the allocated container data structure */ free_containers(lfa); diff --git a/util/json.c b/util/json.c index 25514af..fd30383 100644 --- a/util/json.c +++ b/util/json.c @@ -106,7 +106,6 @@ struct json_object *util_json_object_hex(uint64_t val, return jobj; } = -/* API used to output json object display to console */ void util_display_json_array(FILE *f_out, struct json_object *jarray, uint64_t flags) { @@ -126,26 +125,6 @@ void util_display_json_array(FILE *f_out, struct json_= object *jarray, json_object_put(jarray); } = -/* API used to output json object display to specified file */ -void __util_display_json_array(FILE *fd, struct json_object *jarray, - uint64_t flags) -{ - int len =3D json_object_array_length(jarray); - int jflag =3D JSON_C_TO_STRING_PRETTY; - - if (json_object_array_length(jarray) > 1 || !(flags & UTIL_JSON_HUMAN)) - fprintf(fd, "%s\n", - json_object_to_json_string_ext(jarray, jflag)); - else if (len) { - struct json_object *jobj; - - jobj =3D json_object_array_get_idx(jarray, 0); - fprintf(fd, "%s\n", - json_object_to_json_string_ext(jobj, jflag)); - } - json_object_put(jarray); -} - struct json_object *util_device_to_json(struct accfg_device *device, uint64_t flags) { diff --git a/util/json.h b/util/json.h index 79aad84..7828489 100644 --- a/util/json.h +++ b/util/json.h @@ -17,8 +17,6 @@ enum util_json_flags { struct json_object; void util_display_json_array(FILE *f_out, struct json_object *jarray, uint64_t flags); -void __util_display_json_array(FILE *fd, struct json_object *jarray, - uint64_t flags); struct json_object *util_device_to_json(struct accfg_device *device, uint64_t flags); struct json_object *util_wq_to_json(struct accfg_wq *accfg_wq, -- = 2.26.3 --===============2211279542435435484==--