Yes, something like that. But no need for the GList.
On Sat, Jan 24, 2009 at 7:43 PM, Jerry Maine <crashfou...@gmail.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > You mean something like this? (Released under MIT/X11 license) > > > gboolean* > mono_index_custom_attr (MonoImage *image, guint32 idx, const char > *attr_assembly, const char *attr_name_space, const char *attr) > { > guint32 mtoken, i, len; > guint32 cols [MONO_CUSTOM_ATTR_SIZE]; > MonoTableInfo *ca; > //MonoCustomAttrInfo *ainfo; > GList *tmp, *list = NULL; > MonoMethod* attr_ctor; > > ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE]; > > if ((attr_assembly == NULL) || (attr_name_space == NULL) || (attr > == NULL)) > return FALSE; > > if (!mono_image_has_assembly_ref(assembly->image, attr_assembly) > return FALSE; > > i = mono_metadata_custom_attrs_from_index (image, idx); > if (!i) > return NULL; > i --; > while (i < ca->rows) { > if (mono_metadata_decode_row_col (ca, i, > MONO_CUSTOM_ATTR_PARENT) != idx) > break; > list = g_list_prepend (list, GUINT_TO_POINTER (i)); > ++i; > } > len = g_list_length (list); > if (!len) > return NULL; > > for (i = 0, tmp = list; i < len; ++i, tmp = tmp->next) { > mono_metadata_decode_row (ca, GPOINTER_TO_UINT (tmp->data), > cols, MONO_CUSTOM_ATTR_SIZE); > mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> > MONO_CUSTOM_ATTR_TYPE_BITS; > switch (cols [MONO_CUSTOM_ATTR_TYPE] & > MONO_CUSTOM_ATTR_TYPE_MASK) { > case MONO_CUSTOM_ATTR_TYPE_METHODDEF: > mtoken |= MONO_TOKEN_METHOD_DEF; > break; > case MONO_CUSTOM_ATTR_TYPE_MEMBERREF: > mtoken |= MONO_TOKEN_MEMBER_REF; > break; > default: > g_error ("Unknown table for custom attr type %08x", cols > [MONO_CUSTOM_ATTR_TYPE]); > break; > } > attr_ctor = mono_get_method (image, mtoken, NULL); > if (!attr_ctor) { > g_warning ("Can't find custom attr constructor image: %s > mtoken: 0x%08x", image->name, mtoken); > g_list_free (list); > //g_free (ainfo); > return FALSE; > } else { > if (strcmp (attr_ctor->klass->image->assembly_name, > attr_assembly) ) > continue; > > if (strcmp (attr_ctor->klass->name_space, attr_name_space) ) > continue; > > if (!strcmp (attr_ctor->klass->name, attr_name) ) { > g_list_free (list); > return TRUE; > } > } > } > g_list_free (list); > > return FALSE; > } > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkl7i3sACgkQ1jvea6V8vHJO5ACfRi0EdEaVLnURhKs2gkguhILV > 32oAnAh3013UYegJZ+kbdNxG5oehjfnZ > =uOXp > -----END PGP SIGNATURE----- > > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list >
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list