]> 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>
Fri, 28 Feb 2025 15:13:24 +0000 (15:13 +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 7481e390f2eca8f652bec0455d87eb68a6295e0b..5a131f2c205b5dbf8d77b6abef235fbad2147ae4 100644 (file)
@@ -287,8 +287,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;
 }