]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: make ctf_dynamic_type() the inverse of ctf_static_type()
authorNick Alcock <nick.alcock@oracle.com>
Wed, 29 Jan 2025 12:35:47 +0000 (12:35 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Thu, 30 Oct 2025 14:21:48 +0000 (14:21 +0000)
They're meant to be inverses, which makes it unfortunate that
they check different bounds.  No visible effect yet, since
ctf_typemax and ctf_stypes currently cover the entire type ID
space, but will have an effect shortly.

libctf/ctf-create.c

index e47a19d89ea50807873e2badc3f4e3a7c142f11e..279cd20ac19b30c14e28cca8b9e8da9bf85e683b 100644 (file)
@@ -286,8 +286,8 @@ ctf_dynamic_type (const ctf_dict_t *fp, ctf_id_t type)
 
   idx = LCTF_TYPE_TO_INDEX(fp, type);
 
-  if ((unsigned long) idx <= fp->ctf_typemax)
-    return ctf_dtd_lookup (fp, id);
+  if ((unsigned long) idx > fp->ctf_stypes)
+    return ctf_dtd_lookup (fp, type);
   return NULL;
 }