From: Nick Alcock Date: Fri, 25 Apr 2025 17:17:33 +0000 (+0100) Subject: libctf: strings: don't check for non-deduplicable atoms in the parent X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=343de78445289e7d85d5c7e40702d3d422ca6bad;p=thirdparty%2Fbinutils-gdb.git libctf: strings: don't check for non-deduplicable atoms in the parent Callers of ctf_str_add_no_dedup_ref are indicating that they would like the string they have added a reference to to appear in the current dict and not be deduplicated into the parent. This is true even if the string already exists in the parent, so we should not check for strings in the parent and reuse them in this case. --- diff --git a/libctf/ctf-string.c b/libctf/ctf-string.c index 56257d91f9a..a4c24ccc2f9 100644 --- a/libctf/ctf-string.c +++ b/libctf/ctf-string.c @@ -313,11 +313,12 @@ ctf_str_add_ref_internal (ctf_dict_t *fp, const char *str, int added = 0; ctf_dict_t *lookup_fp = fp; - /* Check for existing atoms in the parent as well. */ + /* Check for existing atoms in the parent as well, unless they are marked + non-deduplicable. */ atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str); - if (!atom && fp->ctf_parent) + if (!atom && fp->ctf_parent && !(flags & CTF_STR_NO_DEDUP)) { lookup_fp = fp->ctf_parent; atom = ctf_dynhash_lookup (lookup_fp->ctf_str_atoms, str);