summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-05-05 12:20:52 +0200
committerRyan Lortie <desrt@desrt.ca>2011-05-05 12:20:52 +0200
commit90d1ea35cf93e2b94c55cc54307841467ecff1c9 (patch)
tree490f43f492f1e859dfe1fd1a35119200c31d10e6
parentf147e855232d2c29b2501cf2cb78aa131ceb4b12 (diff)
downloaddconf-90d1ea35cf93e2b94c55cc54307841467ecff1c9.tar.gz
path checking: check for NULL
Check for NULL dconf key/dir/path and report it as an error.
-rw-r--r--common/dconf-paths.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/common/dconf-paths.c b/common/dconf-paths.c
index 1278d64..6f82ee9 100644
--- a/common/dconf-paths.c
+++ b/common/dconf-paths.c
@@ -41,6 +41,14 @@
#define DCONF_ERROR 0
#define DCONF_ERROR_PATH 0
+#define nonnull \
+ if (string == NULL) { \
+ g_set_error (error, DCONF_ERROR, DCONF_ERROR_PATH, \
+ "%s not specified", type); \
+ return FALSE; \
+ }
+
+
#define absolute \
if ((l = *string++) != '/') \
{ \
@@ -111,7 +119,7 @@ dconf_is_path (const gchar *string,
GError **error)
{
#define type "path"
- vars; absolute; no_double_slash; path;
+ vars; nonnull; absolute; no_double_slash; path;
#undef type
}
@@ -136,7 +144,7 @@ dconf_is_key (const gchar *string,
GError **error)
{
#define type "key"
- vars; absolute; no_double_slash; key;
+ vars; nonnull; absolute; no_double_slash; key;
#undef type
}
@@ -162,7 +170,7 @@ dconf_is_dir (const gchar *string,
GError **error)
{
#define type "dir"
- vars; absolute; no_double_slash; dir;
+ vars; nonnull; absolute; no_double_slash; dir;
#undef type
}
@@ -184,7 +192,7 @@ dconf_is_rel (const gchar *string,
GError **error)
{
#define type "relative path"
- vars; relative; no_double_slash; path;
+ vars; nonnull; relative; no_double_slash; path;
#undef type
}
@@ -209,7 +217,7 @@ dconf_is_rel_key (const gchar *string,
GError **error)
{
#define type "relative key"
- vars; relative; no_double_slash; key;
+ vars; nonnull; relative; no_double_slash; key;
#undef type
}
@@ -235,6 +243,6 @@ dconf_is_rel_dir (const gchar *string,
GError **error)
{
#define type "relative dir"
- vars; relative; no_double_slash; dir;
+ vars; nonnull; relative; no_double_slash; dir;
#undef type
}