From 325faa23799c617c238f110cb77d8a854614c76b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 8 Oct 2015 13:40:45 +0200 Subject: [PATCH] ifcfg-rh: add svSetValueInt64() utility --- src/settings/plugins/ifcfg-rh/shvar.c | 9 +++++++++ src/settings/plugins/ifcfg-rh/shvar.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index ffb0f8f7da..43068c6703 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -445,6 +445,15 @@ svSetValueFull (shvarFile *s, const char *key, const char *value, gboolean verba g_free (keyValue); } +void +svSetValueInt64 (shvarFile *s, const char *key, gint64 value) +{ + gs_free char *v = NULL; + + v = g_strdup_printf ("%"G_GINT64_FORMAT, value); + svSetValueFull (s, key, v, TRUE); +} + /* Write the current contents iff modified. Returns FALSE on error * and TRUE on success. Do not write if no values have been modified. * The mode argument is only used if creating the file, not if diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index d51e07685f..227a44db17 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -75,6 +75,7 @@ gint64 svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, g */ void svSetValue (shvarFile *s, const char *key, const char *value, gboolean verbatim); void svSetValueFull (shvarFile *s, const char *key, const char *value, gboolean verbatim); +void svSetValueInt64 (shvarFile *s, const char *key, gint64 value); /* Write the current contents iff modified. Returns FALSE on error