Browse Source

libpkgconf: personality: fixups

William Pitcock 1 year ago
parent
commit
e6ce6c8edd
2 changed files with 7 additions and 5 deletions
  1. 1
    0
      libpkgconf/libpkgconf.h
  2. 6
    5
      libpkgconf/personality.c

+ 1
- 0
libpkgconf/libpkgconf.h View File

@@ -220,6 +220,7 @@ PKGCONF_API void pkgconf_client_dir_list_build(pkgconf_client_t *client, const p
220 220
 
221 221
 /* personality.c */
222 222
 PKGCONF_API const pkgconf_cross_personality_t *pkgconf_cross_personality_default(void);
223
+PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet);
223 224
 
224 225
 #define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
225 226
 #define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')

+ 6
- 5
libpkgconf/personality.c View File

@@ -131,7 +131,7 @@ personality_fragment_func(pkgconf_cross_personality_t *p, const char *keyword, c
131 131
 	(void) lineno;
132 132
 
133 133
 	pkgconf_list_t *dest = (pkgconf_list_t *)((char *) p + offset);
134
-	pkgconf_fragment_parse(NULL, dest, NULL, value);
134
+	pkgconf_path_split(value, dest, false);
135 135
 }
136 136
 
137 137
 /* keep in alphabetical order! */
@@ -199,7 +199,8 @@ load_personality_with_path(const char *path, const char *triplet)
199 199
 		return NULL;
200 200
 
201 201
 	p = calloc(sizeof(pkgconf_cross_personality_t), 1);
202
-	p->name = strdup(triplet);
202
+	if (triplet != NULL)
203
+		p->name = strdup(triplet);
203 204
 	pkgconf_parser_parse(f, p, personality_parser_ops, personality_warn_func, pathbuf);
204 205
 
205 206
 	return p;
@@ -222,13 +223,13 @@ pkgconf_cross_personality_find(const char *triplet)
222 223
 	pkgconf_node_t *n;
223 224
 	pkgconf_cross_personality_t *out = NULL;
224 225
 
225
-	if (!valid_triplet(triplet))
226
-		return NULL;
227
-
228 226
 	out = load_personality_with_path(triplet, NULL);
229 227
 	if (out != NULL)
230 228
 		return out;
231 229
 
230
+	if (!valid_triplet(triplet))
231
+		return NULL;
232
+
232 233
 	pkgconf_path_split(PERSONALITY_PATH, &plist, true);
233 234
 
234 235
 	PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)