summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
76b8a4b)
Now that we have access to the package in deserialize, we can include
its name.
/*
* Get the full hierarchical object name for an export, used for diagnostics.
/*
* Get the full hierarchical object name for an export, used for diagnostics.
- * Currently, this does not include the package name (which is actually
- * required for this to be a "full" name) as it's not yet passed to the
- * deserialize method.
+ * The package name is passed in pname.
*
* Returns a buffer allocated by malloc on success, or NULL on failure.
*/
*
* Returns a buffer allocated by malloc on success, or NULL on failure.
*/
-static char *get_obj_fullname(const struct upkg_export *e)
+static char *get_obj_fullname(const char *pname, const struct upkg_export *e)
- size_t total_len = 0, len;
+ size_t total_len = strlen(pname) + 1, len;
for (const struct upkg_export *c = e; c; c = c->parent) {
len = strlen(c->name) + 1;
if (total_len > SIZE_MAX - len)
for (const struct upkg_export *c = e; c; c = c->parent) {
len = strlen(c->name) + 1;
if (total_len > SIZE_MAX - len)
fullname[total_len + len] = c == e ? '\0' : '.';
}
fullname[total_len + len] = c == e ? '\0' : '.';
}
+ assert(total_len == strlen(pname)+1);
+ memcpy(fullname, pname, total_len-1);
+ fullname[total_len-1] = '.';
+
e = upkg_get_export(upkg, idx);
if (!e)
return -1;
e = upkg_get_export(upkg, idx);
if (!e)
return -1;
- uo->pkg_name = get_obj_fullname(e);
+ uo->pkg_name = get_obj_fullname(pkg->name, e);
if (!uo->pkg_name)
return -1;
if (!uo->pkg_name)
return -1;