static void dllmap_start (gpointer user_data, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values) { int i; DllInfo *info = user_data; if (strcmp (element_name, "dllmap") == 0) { g_free (info->dll); g_free (info->target); info->dll = info->target = NULL; info->ignore = FALSE; for (i = 0; attribute_names [i]; ++i) { if (strcmp (attribute_names [i], "dll") == 0) info->dll = g_strdup (attribute_values [i]); else if (strcmp (attribute_names [i], "target") == 0) info->target = g_strdup (attribute_values [i]); else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i])) info->ignore = TRUE; else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i])) info->ignore = TRUE; else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i])) info->ignore = TRUE; } if (!info->ignore) mono_dllmap_insert (info->assembly, info->dll, NULL, info->target, NULL); } else if (strcmp (element_name, "dllentry") == 0) { const char *name = NULL, *target = NULL, *dll = NULL; int ignore = FALSE; for (i = 0; attribute_names [i]; ++i) { if (strcmp (attribute_names [i], "dll") == 0) dll = attribute_values [i]; else if (strcmp (attribute_names [i], "target") == 0) target = attribute_values [i]; else if (strcmp (attribute_names [i], "name") == 0) name = attribute_values [i]; else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i])) ignore = TRUE; else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i])) ignore = TRUE; else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i])) ignore = TRUE; } if (!dll) dll = info->dll; if (!info->ignore && !ignore) mono_dllmap_insert (info->assembly, info->dll, name, dll, target); } }
static void dllmap_start (gpointer user_data, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values) { int i; DllInfo *info = (DllInfo *)user_data; if (strcmp (element_name, "dllmap") == 0) { g_free (info->dll); g_free (info->target); info->dll = info->target = NULL; info->ignore = FALSE; for (i = 0; attribute_names [i]; ++i) { if (strcmp (attribute_names [i], "dll") == 0) info->dll = g_strdup (attribute_values [i]); else if (strcmp (attribute_names [i], "target") == 0){ char *p = strstr (attribute_values [i], "$mono_libdir"); if (p != NULL){ const char *libdir = mono_assembly_getrootdir (); size_t libdir_len = strlen (libdir); char *result; result = (char *)g_malloc (libdir_len-strlen("$mono_libdir")+strlen(attribute_values[i])+1); strncpy (result, attribute_values[i], p-attribute_values[i]); strcpy (result+(p-attribute_values[i]), libdir); strcat (result, p+strlen("$mono_libdir")); info->target = result; } else info->target = g_strdup (attribute_values [i]); } else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i])) info->ignore = TRUE; else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i])) info->ignore = TRUE; else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i])) info->ignore = TRUE; } if (!info->ignore) mono_dllmap_insert (info->assembly, info->dll, NULL, info->target, NULL); } else if (strcmp (element_name, "dllentry") == 0) { const char *name = NULL, *target = NULL, *dll = NULL; int ignore = FALSE; for (i = 0; attribute_names [i]; ++i) { if (strcmp (attribute_names [i], "dll") == 0) dll = attribute_values [i]; else if (strcmp (attribute_names [i], "target") == 0) target = attribute_values [i]; else if (strcmp (attribute_names [i], "name") == 0) name = attribute_values [i]; else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i])) ignore = TRUE; else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i])) ignore = TRUE; else if (strcmp (attribute_names [i], "wordsize") == 0 && !arch_matches (CONFIG_WORDSIZE, attribute_values [i])) ignore = TRUE; } if (!dll) dll = info->dll; if (!info->ignore && !ignore) mono_dllmap_insert (info->assembly, info->dll, name, dll, target); } }