Rename metadata to typelib in variable names, comments and apis.

2008-08-09  Johan Dahlin  <johan@gnome.org>

    * *.[ch]:
    Rename metadata to typelib in variable names,
    comments and apis.


svn path=/trunk/; revision=339
This commit is contained in:
Johan Dahlin 2008-08-09 12:55:32 +00:00 committed by Philip Withnall
parent dcd26fddc7
commit c2bbd6ecba

View File

@ -1097,35 +1097,35 @@ write_repository (GIRepository *repository,
} }
static const guchar * static const guchar *
load_metadata (const gchar *filename, load_typelib (const gchar *filename,
GModule **dlhandle, GModule **dlhandle,
gsize *len) gsize *len)
{ {
guchar *metadata; guchar *typelib;
gsize *metadata_size; gsize *typelib_size;
GModule *handle; GModule *handle;
handle = g_module_open (filename, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY); handle = g_module_open (filename, G_MODULE_BIND_LOCAL|G_MODULE_BIND_LAZY);
if (!g_module_symbol (handle, "_G_TYPELIB", (gpointer *) &metadata)) if (!g_module_symbol (handle, "_G_TYPELIB", (gpointer *) &typelib))
{ {
g_printerr ("Could not load metadata from '%s': %s\n", g_printerr ("Could not load typelib from '%s': %s\n",
filename, g_module_error ()); filename, g_module_error ());
return NULL; return NULL;
} }
if (!g_module_symbol (handle, "_G_TYPELIB_SIZE", (gpointer *) &metadata_size)) if (!g_module_symbol (handle, "_G_TYPELIB_SIZE", (gpointer *) &typelib_size))
{ {
g_printerr ("Could not load metadata from '%s': %s\n", g_printerr ("Could not load typelib from '%s': %s\n",
filename, g_module_error ()); filename, g_module_error ());
return NULL; return NULL;
} }
*len = *metadata_size; *len = *typelib_size;
if (dlhandle) if (dlhandle)
*dlhandle = handle; *dlhandle = handle;
return metadata; return typelib;
} }
int int
@ -1140,7 +1140,7 @@ main (int argc, char *argv[])
GTypelib *data; GTypelib *data;
GOptionEntry options[] = GOptionEntry options[] =
{ {
{ "raw", 0, 0, G_OPTION_ARG_NONE, &raw, "handle raw metadata", NULL }, { "raw", 0, 0, G_OPTION_ARG_NONE, &raw, "handle raw typelib", NULL },
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" }, { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
{ NULL, } { NULL, }
@ -1164,12 +1164,12 @@ main (int argc, char *argv[])
for (i = 0; input[i]; i++) for (i = 0; input[i]; i++)
{ {
GModule *dlhandle = NULL; GModule *dlhandle = NULL;
const guchar *metadata; const guchar *typelib;
gsize len; gsize len;
if (raw) if (raw)
{ {
if (!g_file_get_contents (input[i], (gchar **)&metadata, &len, &error)) if (!g_file_get_contents (input[i], (gchar **)&typelib, &len, &error))
{ {
g_fprintf (stderr, "failed to read '%s': %s\n", g_fprintf (stderr, "failed to read '%s': %s\n",
input[i], error->message); input[i], error->message);
@ -1179,10 +1179,10 @@ main (int argc, char *argv[])
} }
else else
{ {
metadata = load_metadata (input[i], &dlhandle, &len); typelib = load_typelib (input[i], &dlhandle, &len);
if (!metadata) if (!typelib)
{ {
g_fprintf (stderr, "failed to load metadata from '%s'\n", g_fprintf (stderr, "failed to load typelib from '%s'\n",
input[i]); input[i]);
continue; continue;
} }
@ -1193,11 +1193,11 @@ main (int argc, char *argv[])
else else
needs_prefix = FALSE; needs_prefix = FALSE;
data = g_typelib_new_from_const_memory (metadata, len); data = g_typelib_new_from_const_memory (typelib, len);
{ {
GError *error = NULL; GError *error = NULL;
if (!g_typelib_validate (data, &error)) { if (!g_typelib_validate (data, &error)) {
g_printerr ("metadata not valid: %s\n", error->message); g_printerr ("typelib not valid: %s\n", error->message);
g_clear_error (&error); g_clear_error (&error);
} }
} }