summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaLyong Cho <walyong.cho@samsung.com>2016-12-06 00:33:58 (GMT)
committerWaLyong Cho <walyong.cho@samsung.com>2016-12-06 00:34:10 (GMT)
commit26e7c65878e00c2c99d2bd6700780ce2a75450d8 (patch)
treede61418c210312daf4e1c957e3144623f4643939
parent1a7559d8f6e975cfbc6cf36300b7fcf61b2cb50d (diff)
parentfdb8eeac72ab5dd584e58b54b4af1cc49f43ad26 (diff)
downloadlibsystem-26e7c65878e00c2c99d2bd6700780ce2a75450d8.zip
libsystem-26e7c65878e00c2c99d2bd6700780ce2a75450d8.tar.gz
libsystem-26e7c65878e00c2c99d2bd6700780ce2a75450d8.tar.bz2
release: 4.0-4
[Model] Common [BinType] AP [Customer] N/A [Issue] N/A [Request] N/A [Occurrence Version] N/A [Problem] release: 4.0-4 [Cause & Measure] N/A [Checking Method] N/A [Team] SystemFW [Developer] WaLyong Cho [Solution company] Samsung [Change Type] N/A * devel/systemfw/master: release: 4.0-4 libsystem: config-parser: add percent config parse api Change-Id: I657666b5480c25582fe2c42b2e5e6ff9ad06551b Signed-off-by: WaLyong Cho <walyong.cho@samsung.com>
-rw-r--r--packaging/libsystem.spec2
-rw-r--r--src/libsystem/config-parser.c28
-rw-r--r--src/libsystem/config-parser.h16
3 files changed, 45 insertions, 1 deletions
diff --git a/packaging/libsystem.spec b/packaging/libsystem.spec
index a85a0a6..e2a32d4 100644
--- a/packaging/libsystem.spec
+++ b/packaging/libsystem.spec
@@ -1,7 +1,7 @@
Name: libsystem
Summary: System Libraries
Version: 4.0
-Release: 3%{?release_flags}
+Release: 4%{?release_flags}
License: Apache-2.0
Group: System/Libraries
Source: %{name}-%{version}.tar.gz
diff --git a/src/libsystem/config-parser.c b/src/libsystem/config-parser.c
index 3319056..e6ade0e 100644
--- a/src/libsystem/config-parser.c
+++ b/src/libsystem/config-parser.c
@@ -345,3 +345,31 @@ int config_parse_bytes(
return 0;
}
+
+int config_parse_percent(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data) {
+
+ size_t *percent = data, p = 0;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ if (!isempty(rvalue)) {
+ r = parse_percent(rvalue, &p);
+ if (r < 0)
+ return r;
+ }
+
+ *percent = p;
+
+ return 0;
+}
diff --git a/src/libsystem/config-parser.h b/src/libsystem/config-parser.h
index f2e9d3f..1909fe8 100644
--- a/src/libsystem/config-parser.h
+++ b/src/libsystem/config-parser.h
@@ -171,6 +171,22 @@ int config_parse_string(const char *filename, unsigned line, const char *section
*/
int config_parse_bytes(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data);
+/**
+ * @brief A common percent(%) type rvalue parser. The right value has
+ * to be end with '%'.
+ *
+ * @param filename a parsing config file name
+ * @param line a parsing config file line
+ * @param section a parsing config file section
+ * @param lvalue a parsing config file left value
+ * @param ltype a parsing config file left value type. (not used.)
+ * @param rvalue a parsing config file rvalue
+ * @param data user data
+ *
+ * @return 0 on success, -errno on failure.
+ */
+int config_parse_percent(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data);
+
#ifdef __cplusplus
}
#endif