[Accel-config] [PATCH v1 1/6] accel-config: Remove duplicated function
ramesh.thomas at intel.com
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
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 <ramesh.thomas(a)intel.com>
---
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, const 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 = json_object_array_length(jarray);
- int jflag = 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 = 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