(mu_property_sget_value,mu_property_aget_value): New functions
Showing
2 changed files
with
34 additions
and
0 deletions
... | @@ -34,6 +34,10 @@ extern void *mu_property_get_owner (mu_property_t); | ... | @@ -34,6 +34,10 @@ extern void *mu_property_get_owner (mu_property_t); |
34 | extern int mu_property_set_value (mu_property_t, const char *, const char *, int); | 34 | extern int mu_property_set_value (mu_property_t, const char *, const char *, int); |
35 | extern int mu_property_get_value (mu_property_t, const char *, char *, size_t, | 35 | extern int mu_property_get_value (mu_property_t, const char *, char *, size_t, |
36 | size_t *); | 36 | size_t *); |
37 | extern int mu_property_sget_value (mu_property_t prop, const char *key, | ||
38 | const char **buffer); | ||
39 | extern int mu_property_aget_value (mu_property_t prop, const char *key, | ||
40 | char **buffer); | ||
37 | 41 | ||
38 | /* Helper functions. */ | 42 | /* Helper functions. */ |
39 | extern int mu_property_set (mu_property_t, const char *); | 43 | extern int mu_property_set (mu_property_t, const char *); | ... | ... |
... | @@ -146,6 +146,36 @@ mu_property_get_value (mu_property_t prop, const char *key, char *buffer, | ... | @@ -146,6 +146,36 @@ mu_property_get_value (mu_property_t prop, const char *key, char *buffer, |
146 | } | 146 | } |
147 | 147 | ||
148 | int | 148 | int |
149 | mu_property_sget_value (mu_property_t prop, const char *key, | ||
150 | const char **buffer) | ||
151 | { | ||
152 | struct property_item *item = NULL; | ||
153 | int status; | ||
154 | |||
155 | status = property_find (prop, key, &item); | ||
156 | if (status == 0) | ||
157 | *buffer = item->value; | ||
158 | return status; | ||
159 | } | ||
160 | |||
161 | int | ||
162 | mu_property_aget_value (mu_property_t prop, const char *key, | ||
163 | char **buffer) | ||
164 | { | ||
165 | struct property_item *item = NULL; | ||
166 | int status; | ||
167 | |||
168 | status = property_find (prop, key, &item); | ||
169 | if (status == 0) | ||
170 | { | ||
171 | *buffer = strdup (item->value); | ||
172 | if (!*buffer) | ||
173 | status = ENOMEM; | ||
174 | } | ||
175 | return status; | ||
176 | } | ||
177 | |||
178 | int | ||
149 | mu_property_set (mu_property_t prop, const char *k) | 179 | mu_property_set (mu_property_t prop, const char *k) |
150 | { | 180 | { |
151 | struct property_item *item = NULL; | 181 | struct property_item *item = NULL; | ... | ... |
-
Please register or sign in to post a comment