diff options
| author | Burt P <pburt0@gmail.com> | 2017-08-15 12:18:43 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-08-21 05:56:57 -0700 | 
| commit | 3b7d49dbf54e5fae9998a156e7aeef6f7639e45d (patch) | |
| tree | d322de3f6b045e21116d8b1a0f7d7e4193d2ede9 | |
| parent | 66701a47f82a563c81ca1ec69cea1f8bb5a60af9 (diff) | |
Translate unit labels in Devices/Memory
Signed-off-by: Burt P <pburt0@gmail.com>
| -rw-r--r-- | modules/devices/devmemory.c | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/modules/devices/devmemory.c b/modules/devices/devmemory.c index 080e2bbe..29094dd8 100644 --- a/modules/devices/devmemory.c +++ b/modules/devices/devmemory.c @@ -23,7 +23,7 @@ GHashTable *memlabels = NULL;  void scan_memory_do(void)  { -    gchar **keys, *tmp, *tmp_label; +    gchar **keys, *tmp, *tmp_label, *trans_val;      static gint offset = -1;      gint i; @@ -68,12 +68,20 @@ void scan_memory_do(void)              tmp_label = ""; /* or newkeys[0] */          /* although it doesn't matter... */ -        moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(newkeys[1])); +        if (strstr(newkeys[1], "kB")) { +            trans_val = g_strdup_printf("%d %s", atoi(newkeys[1]), _("KiB") ); +        } else { +            trans_val = strdup(newkeys[1]); +        } -        tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "|", tmp_label, "\n", NULL); +        moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(trans_val)); + +        tmp = g_strconcat(meminfo, newkeys[0], "=", trans_val, "|", tmp_label, "\n", NULL);          g_free(meminfo);          meminfo = tmp; +        g_free(trans_val); +          tmp = g_strconcat(lginterval,                            "UpdateInterval$", newkeys[0], "=1000\n", NULL);          g_free(lginterval); | 
