girepository: Remove _ prefix from private functions

Now that libgirepository uses `GI_AVAILABLE_IN_*` macros, that’s what
controls symbol visibility. The `_` prefixes are redundant, and out of
keeping with the rest of GLib.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2023-11-08 15:23:31 +00:00
parent 7b029e564d
commit 2b544c3f66
26 changed files with 518 additions and 518 deletions

View File

@ -308,7 +308,7 @@ gi_arg_info_get_type (GIArgInfo *info)
g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ARG_INFO (info), NULL); g_return_val_if_fail (GI_IS_ARG_INFO (info), NULL);
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type)); return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
} }
/** /**
@ -331,5 +331,5 @@ gi_arg_info_load_type (GIArgInfo *info,
g_return_if_fail (info != NULL); g_return_if_fail (info != NULL);
g_return_if_fail (GI_IS_ARG_INFO (info)); g_return_if_fail (GI_IS_ARG_INFO (info));
_gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type)); gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
} }

View File

@ -53,11 +53,11 @@ gi_base_info_gtype_get_type (void)
/* info creation */ /* info creation */
GIBaseInfo * GIBaseInfo *
_gi_info_new_full (GIInfoType type, gi_info_new_full (GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
GIRealInfo *info; GIRealInfo *info;
@ -65,7 +65,7 @@ _gi_info_new_full (GIInfoType type,
info = g_slice_new (GIRealInfo); info = g_slice_new (GIRealInfo);
_gi_info_init (info, type, repository, container, typelib, offset); gi_info_init (info, type, repository, container, typelib, offset);
info->ref_count = 1; info->ref_count = 1;
if (container && ((GIRealInfo *) container)->ref_count != INVALID_REFCOUNT) if (container && ((GIRealInfo *) container)->ref_count != INVALID_REFCOUNT)
@ -93,16 +93,16 @@ gi_info_new (GIInfoType type,
GITypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
return _gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset); return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
} }
void void
_gi_info_init (GIRealInfo *info, gi_info_init (GIRealInfo *info,
GIInfoType type, GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
memset (info, 0, sizeof (GIRealInfo)); memset (info, 0, sizeof (GIRealInfo));
@ -121,15 +121,15 @@ _gi_info_init (GIRealInfo *info,
} }
GIBaseInfo * GIBaseInfo *
_gi_info_from_entry (GIRepository *repository, gi_info_from_entry (GIRepository *repository,
GITypelib *typelib, GITypelib *typelib,
guint16 index) guint16 index)
{ {
GIBaseInfo *result; GIBaseInfo *result;
DirEntry *entry = gi_typelib_get_dir_entry (typelib, index); DirEntry *entry = gi_typelib_get_dir_entry (typelib, index);
if (entry->local) if (entry->local)
result = _gi_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset); result = gi_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
else else
{ {
const gchar *namespace = gi_typelib_get_string (typelib, entry->offset); const gchar *namespace = gi_typelib_get_string (typelib, entry->offset);
@ -158,9 +158,9 @@ _gi_info_from_entry (GIRepository *repository,
} }
GITypeInfo * GITypeInfo *
_gi_type_info_new (GIBaseInfo *container, gi_type_info_new (GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
@ -169,16 +169,16 @@ _gi_type_info_new (GIBaseInfo *container,
} }
void void
_gi_type_info_init (GIBaseInfo *info, gi_type_info_init (GIBaseInfo *info,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
GIRealInfo *rinfo = (GIRealInfo*)container; GIRealInfo *rinfo = (GIRealInfo*)container;
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
_gi_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib, gi_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset); (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
} }
/* GIBaseInfo functions */ /* GIBaseInfo functions */

View File

@ -184,7 +184,7 @@ gi_callable_info_get_return_type (GICallableInfo *info)
offset = signature_offset (info); offset = signature_offset (info);
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, offset); return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, offset);
} }
@ -211,7 +211,7 @@ gi_callable_info_load_return_type (GICallableInfo *info,
offset = signature_offset (info); offset = signature_offset (info);
_gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, offset); gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, offset);
} }
/** /**
@ -392,8 +392,8 @@ gi_callable_info_load_arg (GICallableInfo *info,
offset = signature_offset (info); offset = signature_offset (info);
header = (Header *)rinfo->typelib->data; header = (Header *)rinfo->typelib->data;
_gi_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib, gi_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
offset + header->signature_blob_size + n * header->arg_blob_size); offset + header->signature_blob_size + n * header->arg_blob_size);
} }
/** /**

View File

@ -62,7 +62,7 @@ gi_constant_info_get_type (GIConstantInfo *info)
g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_CONSTANT_INFO (info), NULL); g_return_val_if_fail (GI_IS_CONSTANT_INFO (info), NULL);
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8); return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
} }
#define DO_ALIGNED_COPY(dest_addr, src_addr, type) \ #define DO_ALIGNED_COPY(dest_addr, src_addr, type) \

View File

@ -156,7 +156,7 @@ gi_field_info_get_type (GIFieldInfo *info)
type_info->type_is_embedded = TRUE; type_info->type_is_embedded = TRUE;
} }
else else
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type)); return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
return (GIBaseInfo*)type_info; return (GIBaseInfo*)type_info;
} }

View File

@ -48,10 +48,10 @@
*/ */
GIFunctionInfo * GIFunctionInfo *
_gi_base_info_find_method (GIBaseInfo *base, gi_base_info_find_method (GIBaseInfo *base,
guint32 offset, guint32 offset,
gint n_methods, gint n_methods,
const gchar *name) const gchar *name)
{ {
/* FIXME hash */ /* FIXME hash */
GIRealInfo *rinfo = (GIRealInfo*)base; GIRealInfo *rinfo = (GIRealInfo*)base;

View File

@ -88,8 +88,8 @@ gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset]; blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
return _gi_info_from_entry (rinfo->repository, return gi_info_from_entry (rinfo->repository,
rinfo->typelib, blob->prerequisites[n]); rinfo->typelib, blob->prerequisites[n]);
} }
@ -228,7 +228,7 @@ gi_interface_info_find_method (GIInterfaceInfo *info,
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2 + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ blob->n_properties * header->property_blob_size; + blob->n_properties * header->property_blob_size;
return _gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name); return gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
} }
/** /**
@ -412,7 +412,7 @@ gi_interface_info_find_vfunc (GIInterfaceInfo *info,
+ blob->n_methods * header->function_blob_size + blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size; + blob->n_signals * header->signal_blob_size;
return _gi_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name); return gi_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
} }
/** /**
@ -495,8 +495,8 @@ gi_interface_info_get_iface_struct (GIInterfaceInfo *info)
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset]; blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->gtype_struct) if (blob->gtype_struct)
return (GIStructInfo *) _gi_info_from_entry (rinfo->repository, return (GIStructInfo *) gi_info_from_entry (rinfo->repository,
rinfo->typelib, blob->gtype_struct); rinfo->typelib, blob->gtype_struct);
else else
return NULL; return NULL;
} }

View File

@ -103,8 +103,8 @@ gi_object_info_get_parent (GIObjectInfo *info)
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset]; blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->parent) if (blob->parent)
return (GIObjectInfo *) _gi_info_from_entry (rinfo->repository, return (GIObjectInfo *) gi_info_from_entry (rinfo->repository,
rinfo->typelib, blob->parent); rinfo->typelib, blob->parent);
else else
return NULL; return NULL;
} }
@ -269,8 +269,8 @@ gi_object_info_get_interface (GIObjectInfo *info,
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset]; blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
return (GIInterfaceInfo *) _gi_info_from_entry (rinfo->repository, return (GIInterfaceInfo *) gi_info_from_entry (rinfo->repository,
rinfo->typelib, blob->interfaces[n]); rinfo->typelib, blob->interfaces[n]);
} }
/** /**
@ -467,7 +467,7 @@ gi_object_info_find_method (GIObjectInfo *info,
+ blob->n_field_callbacks * header->callback_blob_size + blob->n_field_callbacks * header->callback_blob_size
+ blob->n_properties * header->property_blob_size; + blob->n_properties * header->property_blob_size;
return _gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name); return gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
} }
/** /**
@ -718,7 +718,7 @@ gi_object_info_find_vfunc (GIObjectInfo *info,
+ blob->n_methods * header->function_blob_size + blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size; + blob->n_signals * header->signal_blob_size;
return _gi_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name); return gi_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
} }
/** /**
@ -864,8 +864,8 @@ gi_object_info_get_class_struct (GIObjectInfo *info)
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset]; blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->gtype_struct) if (blob->gtype_struct)
return (GIStructInfo *) _gi_info_from_entry (rinfo->repository, return (GIStructInfo *) gi_info_from_entry (rinfo->repository,
rinfo->typelib, blob->gtype_struct); rinfo->typelib, blob->gtype_struct);
else else
return NULL; return NULL;
} }

View File

@ -96,9 +96,9 @@ gi_property_info_get_type (GIPropertyInfo *info)
g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_PROPERTY_INFO (info), NULL); g_return_val_if_fail (GI_IS_PROPERTY_INFO (info), NULL);
return _gi_type_info_new ((GIBaseInfo*)info, return gi_type_info_new ((GIBaseInfo*)info,
rinfo->typelib, rinfo->typelib,
rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type)); rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type));
} }
/** /**

View File

@ -78,38 +78,38 @@ struct _GIUnresolvedInfo
const gchar *namespace; const gchar *namespace;
}; };
void _gi_info_init (GIRealInfo *info, void gi_info_init (GIRealInfo *info,
GIInfoType type, GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GIBaseInfo * _gi_info_from_entry (GIRepository *repository, GIBaseInfo * gi_info_from_entry (GIRepository *repository,
GITypelib *typelib, GITypelib *typelib,
guint16 index); guint16 index);
GIBaseInfo * _gi_info_new_full (GIInfoType type, GIBaseInfo * gi_info_new_full (GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GITypeInfo * _gi_type_info_new (GIBaseInfo *container, GITypeInfo * gi_type_info_new (GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
void _gi_type_info_init (GIBaseInfo *info, void gi_type_info_init (GIBaseInfo *info,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GIFunctionInfo * _gi_base_info_find_method (GIBaseInfo *base, GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base,
guint32 offset, guint32 offset,
gint n_methods, gint n_methods,
const gchar *name); const gchar *name);
GIVFuncInfo * _gi_base_info_find_vfunc (GIRealInfo *rinfo, GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo,
guint32 offset, guint32 offset,
gint n_vfuncs, gint n_vfuncs,
const gchar *name); const gchar *name);

View File

@ -754,9 +754,9 @@ gi_repository_get_info (GIRepository *repository,
entry = gi_typelib_get_dir_entry (typelib, index + 1); entry = gi_typelib_get_dir_entry (typelib, index + 1);
if (entry == NULL) if (entry == NULL)
return NULL; return NULL;
return _gi_info_new_full (entry->blob_type, return gi_info_new_full (entry->blob_type,
repository, repository,
NULL, typelib, entry->offset); NULL, typelib, entry->offset);
} }
typedef struct { typedef struct {
@ -854,9 +854,9 @@ gi_repository_find_by_gtype (GIRepository *repository,
if (entry != NULL) if (entry != NULL)
{ {
cached = _gi_info_new_full (entry->blob_type, cached = gi_info_new_full (entry->blob_type,
repository, repository,
NULL, data.result_typelib, entry->offset); NULL, data.result_typelib, entry->offset);
g_hash_table_insert (repository->priv->info_by_gtype, g_hash_table_insert (repository->priv->info_by_gtype,
(gpointer) gtype, (gpointer) gtype,
@ -901,9 +901,9 @@ gi_repository_find_by_name (GIRepository *repository,
entry = gi_typelib_get_dir_entry_by_name (typelib, name); entry = gi_typelib_get_dir_entry_by_name (typelib, name);
if (entry == NULL) if (entry == NULL)
return NULL; return NULL;
return _gi_info_new_full (entry->blob_type, return gi_info_new_full (entry->blob_type,
repository, repository,
NULL, typelib, entry->offset); NULL, typelib, entry->offset);
} }
typedef struct { typedef struct {
@ -971,9 +971,9 @@ gi_repository_find_by_error_domain (GIRepository *repository,
if (data.result != NULL) if (data.result != NULL)
{ {
cached = _gi_info_new_full (data.result->blob_type, cached = gi_info_new_full (data.result->blob_type,
repository, repository,
NULL, data.result_typelib, data.result->offset); NULL, data.result_typelib, data.result->offset);
g_hash_table_insert (repository->priv->info_by_error_domain, g_hash_table_insert (repository->priv->info_by_error_domain,
GUINT_TO_POINTER (domain), GUINT_TO_POINTER (domain),

View File

@ -66,20 +66,20 @@ struct _GIIrModule
GHashTable *disguised_structures; GHashTable *disguised_structures;
}; };
GIIrModule *_gi_ir_module_new (const gchar *name, GIIrModule *gi_ir_module_new (const gchar *name,
const gchar *nsversion, const gchar *nsversion,
const gchar *module_filename, const gchar *module_filename,
const gchar *c_prefix); const gchar *c_prefix);
void _gi_ir_module_free (GIIrModule *module); void gi_ir_module_free (GIIrModule *module);
void _gi_ir_module_add_include_module (GIIrModule *module, void gi_ir_module_add_include_module (GIIrModule *module,
GIIrModule *include_module); GIIrModule *include_module);
GITypelib * _gi_ir_module_build_typelib (GIIrModule *module); GITypelib * gi_ir_module_build_typelib (GIIrModule *module);
void _gi_ir_module_fatal (GIIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN; void gi_ir_module_fatal (GIIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
void _gi_ir_node_init_stats (void); void gi_ir_node_init_stats (void);
void _gi_ir_node_dump_stats (void); void gi_ir_node_dump_stats (void);
G_END_DECLS G_END_DECLS

View File

@ -38,10 +38,10 @@
#define NUM_SECTIONS 2 #define NUM_SECTIONS 2
GIIrModule * GIIrModule *
_gi_ir_module_new (const gchar *name, gi_ir_module_new (const gchar *name,
const gchar *version, const gchar *version,
const gchar *shared_library, const gchar *shared_library,
const gchar *c_prefix) const gchar *c_prefix)
{ {
GIIrModule *module; GIIrModule *module;
@ -64,14 +64,14 @@ _gi_ir_module_new (const gchar *name,
} }
void void
_gi_ir_module_free (GIIrModule *module) gi_ir_module_free (GIIrModule *module)
{ {
GList *e; GList *e;
g_free (module->name); g_free (module->name);
for (e = module->entries; e; e = e->next) for (e = module->entries; e; e = e->next)
_gi_ir_node_free ((GIIrNode *)e->data); gi_ir_node_free ((GIIrNode *)e->data);
g_list_free (module->entries); g_list_free (module->entries);
/* Don't free dependencies, we inherit that from the parser */ /* Don't free dependencies, we inherit that from the parser */
@ -86,7 +86,7 @@ _gi_ir_module_free (GIIrModule *module)
} }
/** /**
* _gi_ir_module_fatal: * gi_ir_module_fatal:
* @build: Current build * @build: Current build
* @line: Origin line number, or 0 if unknown * @line: Origin line number, or 0 if unknown
* @msg: printf-format string * @msg: printf-format string
@ -95,10 +95,10 @@ _gi_ir_module_free (GIIrModule *module)
* Report a fatal error, then exit. * Report a fatal error, then exit.
*/ */
void void
_gi_ir_module_fatal (GIIrTypelibBuild *build, gi_ir_module_fatal (GIIrTypelibBuild *build,
guint line, guint line,
const char *msg, const char *msg,
...) ...)
{ {
GString *context; GString *context;
char *formatted; char *formatted;
@ -168,8 +168,8 @@ add_disguised_structure_foreach (gpointer key,
} }
void void
_gi_ir_module_add_include_module (GIIrModule *module, gi_ir_module_add_include_module (GIIrModule *module,
GIIrModule *include_module) GIIrModule *include_module)
{ {
module->include_modules = g_list_prepend (module->include_modules, module->include_modules = g_list_prepend (module->include_modules,
include_module); include_module);
@ -206,8 +206,8 @@ write_attribute (gpointer key, gpointer value, gpointer datap)
*(data->offset) += sizeof (AttributeBlob); *(data->offset) += sizeof (AttributeBlob);
blob->offset = data->node->offset; blob->offset = data->node->offset;
blob->name = _gi_ir_write_string ((const char*) key, data->strings, data->databuf, data->offset2); blob->name = gi_ir_write_string ((const char*) key, data->strings, data->databuf, data->offset2);
blob->value = _gi_ir_write_string ((const char*) value, data->strings, data->databuf, data->offset2); blob->value = gi_ir_write_string ((const char*) value, data->strings, data->databuf, data->offset2);
data->count++; data->count++;
} }
@ -274,7 +274,7 @@ add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2)
guint16 required_size; guint16 required_size;
guint32 new_offset; guint32 new_offset;
dirindex_builder = _gi_typelib_hash_builder_new (); dirindex_builder = gi_typelib_hash_builder_new ();
n_interfaces = ((Header *)data)->n_local_entries; n_interfaces = ((Header *)data)->n_local_entries;
@ -283,37 +283,37 @@ add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2)
const char *str; const char *str;
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)]; entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
str = (const char *) (&data[entry->name]); str = (const char *) (&data[entry->name]);
_gi_typelib_hash_builder_add_string (dirindex_builder, str, i); gi_typelib_hash_builder_add_string (dirindex_builder, str, i);
} }
if (!_gi_typelib_hash_builder_prepare (dirindex_builder)) if (!gi_typelib_hash_builder_prepare (dirindex_builder))
{ {
/* This happens if CMPH couldn't create a perfect hash. So /* This happens if CMPH couldn't create a perfect hash. So
* we just punt and leave no directory index section. * we just punt and leave no directory index section.
*/ */
_gi_typelib_hash_builder_destroy (dirindex_builder); gi_typelib_hash_builder_destroy (dirindex_builder);
return data; return data;
} }
alloc_section (data, GI_SECTION_DIRECTORY_INDEX, *offset2); alloc_section (data, GI_SECTION_DIRECTORY_INDEX, *offset2);
required_size = _gi_typelib_hash_builder_get_buffer_size (dirindex_builder); required_size = gi_typelib_hash_builder_get_buffer_size (dirindex_builder);
required_size = ALIGN_VALUE (required_size, 4); required_size = ALIGN_VALUE (required_size, 4);
new_offset = *offset2 + required_size; new_offset = *offset2 + required_size;
data = g_realloc (data, new_offset); data = g_realloc (data, new_offset);
_gi_typelib_hash_builder_pack (dirindex_builder, ((guint8*)data) + *offset2, required_size); gi_typelib_hash_builder_pack (dirindex_builder, ((guint8*)data) + *offset2, required_size);
*offset2 = new_offset; *offset2 = new_offset;
_gi_typelib_hash_builder_destroy (dirindex_builder); gi_typelib_hash_builder_destroy (dirindex_builder);
return data; return data;
} }
GITypelib * GITypelib *
_gi_ir_module_build_typelib (GIIrModule *module) gi_ir_module_build_typelib (GIIrModule *module)
{ {
GError *error = NULL; GError *error = NULL;
GITypelib *typelib; GITypelib *typelib;
@ -360,7 +360,7 @@ _gi_ir_module_build_typelib (GIIrModule *module)
} }
restart: restart:
_gi_ir_node_init_stats (); gi_ir_node_init_stats ();
strings = g_hash_table_new (g_str_hash, g_str_equal); strings = g_hash_table_new (g_str_hash, g_str_equal);
types = g_hash_table_new (g_str_hash, g_str_equal); types = g_hash_table_new (g_str_hash, g_str_equal);
nodes_with_attributes = NULL; nodes_with_attributes = NULL;
@ -378,7 +378,7 @@ _gi_ir_module_build_typelib (GIIrModule *module)
{ {
GIIrNode *node = e->data; GIIrNode *node = e->data;
size += _gi_ir_node_get_full_size (node); size += gi_ir_node_get_full_size (node);
/* Also reset the offset here */ /* Also reset the offset here */
node->offset = 0; node->offset = 0;
@ -414,17 +414,17 @@ _gi_ir_module_build_typelib (GIIrModule *module)
* the size calculations above. * the size calculations above.
*/ */
if (dependencies != NULL) if (dependencies != NULL)
header->dependencies = _gi_ir_write_string (dependencies, strings, data, &header_size); header->dependencies = gi_ir_write_string (dependencies, strings, data, &header_size);
else else
header->dependencies = 0; header->dependencies = 0;
header->size = 0; /* filled in later */ header->size = 0; /* filled in later */
header->namespace = _gi_ir_write_string (module->name, strings, data, &header_size); header->namespace = gi_ir_write_string (module->name, strings, data, &header_size);
header->nsversion = _gi_ir_write_string (module->version, strings, data, &header_size); header->nsversion = gi_ir_write_string (module->version, strings, data, &header_size);
header->shared_library = (module->shared_library? header->shared_library = (module->shared_library?
_gi_ir_write_string (module->shared_library, strings, data, &header_size) gi_ir_write_string (module->shared_library, strings, data, &header_size)
: 0); : 0);
if (module->c_prefix != NULL) if (module->c_prefix != NULL)
header->c_prefix = _gi_ir_write_string (module->c_prefix, strings, data, &header_size); header->c_prefix = gi_ir_write_string (module->c_prefix, strings, data, &header_size);
else else
header->c_prefix = 0; header->c_prefix = 0;
header->entry_blob_size = sizeof (DirEntry); header->entry_blob_size = sizeof (DirEntry);
@ -507,18 +507,18 @@ _gi_ir_module_build_typelib (GIIrModule *module)
entry->blob_type = 0; entry->blob_type = 0;
entry->local = FALSE; entry->local = FALSE;
entry->offset = _gi_ir_write_string (namespace, strings, data, &offset2); entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
entry->name = _gi_ir_write_string (node->name, strings, data, &offset2); entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
} }
else else
{ {
old_offset = offset; old_offset = offset;
offset2 = offset + _gi_ir_node_get_size (node); offset2 = offset + gi_ir_node_get_size (node);
entry->blob_type = node->type; entry->blob_type = node->type;
entry->local = TRUE; entry->local = TRUE;
entry->offset = offset; entry->offset = offset;
entry->name = _gi_ir_write_string (node->name, strings, data, &offset2); entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
memset (&build, 0, sizeof (build)); memset (&build, 0, sizeof (build));
build.module = module; build.module = module;
@ -527,13 +527,13 @@ _gi_ir_module_build_typelib (GIIrModule *module)
build.nodes_with_attributes = nodes_with_attributes; build.nodes_with_attributes = nodes_with_attributes;
build.n_attributes = header->n_attributes; build.n_attributes = header->n_attributes;
build.data = data; build.data = data;
_gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL); gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
nodes_with_attributes = build.nodes_with_attributes; nodes_with_attributes = build.nodes_with_attributes;
header->n_attributes = build.n_attributes; header->n_attributes = build.n_attributes;
if (offset2 > old_offset + _gi_ir_node_get_full_size (node)) if (offset2 > old_offset + gi_ir_node_get_full_size (node))
g_error ("left a hole of %d bytes\n", offset2 - old_offset - _gi_ir_node_get_full_size (node)); g_error ("left a hole of %d bytes\n", offset2 - old_offset - gi_ir_node_get_full_size (node));
} }
entry++; entry++;
@ -544,7 +544,7 @@ _gi_ir_module_build_typelib (GIIrModule *module)
g_message ("header: %d entries, %d attributes", header->n_entries, header->n_attributes); g_message ("header: %d entries, %d attributes", header->n_entries, header->n_attributes);
_gi_ir_node_dump_stats (); gi_ir_node_dump_stats ();
/* Write attributes after the blobs */ /* Write attributes after the blobs */
offset = offset2; offset = offset2;

View File

@ -363,38 +363,38 @@ struct _GIIrNodeUnion
}; };
GIIrNode *_gi_ir_node_new (GIIrNodeTypeId type, GIIrNode *gi_ir_node_new (GIIrNodeTypeId type,
GIIrModule *module); GIIrModule *module);
void _gi_ir_node_free (GIIrNode *node); void gi_ir_node_free (GIIrNode *node);
guint32 _gi_ir_node_get_size (GIIrNode *node); guint32 gi_ir_node_get_size (GIIrNode *node);
guint32 _gi_ir_node_get_full_size (GIIrNode *node); guint32 gi_ir_node_get_full_size (GIIrNode *node);
void _gi_ir_node_build_typelib (GIIrNode *node, void gi_ir_node_build_typelib (GIIrNode *node,
GIIrNode *parent, GIIrNode *parent,
GIIrTypelibBuild *build, GIIrTypelibBuild *build,
guint32 *offset, guint32 *offset,
guint32 *offset2, guint32 *offset2,
guint16 *count2); guint16 *count2);
int _gi_ir_node_cmp (GIIrNode *node, int gi_ir_node_cmp (GIIrNode *node,
GIIrNode *other); GIIrNode *other);
gboolean _gi_ir_node_can_have_member (GIIrNode *node); gboolean gi_ir_node_can_have_member (GIIrNode *node);
void _gi_ir_node_add_member (GIIrNode *node, void gi_ir_node_add_member (GIIrNode *node,
GIIrNodeFunction *member); GIIrNodeFunction *member);
guint32 _gi_ir_write_string (const gchar *str, guint32 gi_ir_write_string (const gchar *str,
GHashTable *strings, GHashTable *strings,
guchar *data, guchar *data,
guint32 *offset); guint32 *offset);
const gchar * _gi_ir_node_param_direction_string (GIIrNodeParam * node); const gchar * gi_ir_node_param_direction_string (GIIrNodeParam * node);
const gchar * _gi_ir_node_type_to_string (GIIrNodeTypeId type); const gchar * gi_ir_node_type_to_string (GIIrNodeTypeId type);
GIIrNode *_gi_ir_find_node (GIIrTypelibBuild *build, GIIrNode *gi_ir_find_node (GIIrTypelibBuild *build,
GIIrModule *module, GIIrModule *module,
const char *name); const char *name);
/* In giroffsets.c */ /* In giroffsets.c */
void _gi_ir_node_compute_offsets (GIIrTypelibBuild *build, void gi_ir_node_compute_offsets (GIIrTypelibBuild *build,
GIIrNode *node); GIIrNode *node);
G_END_DECLS G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@ -194,16 +194,16 @@ get_interface_size_alignment (GIIrTypelibBuild *build,
{ {
GIIrNode *iface; GIIrNode *iface;
iface = _gi_ir_find_node (build, ((GIIrNode*)type)->module, type->giinterface); iface = gi_ir_find_node (build, ((GIIrNode*)type)->module, type->giinterface);
if (!iface) if (!iface)
{ {
_gi_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->giinterface, who); gi_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->giinterface, who);
*size = -1; *size = -1;
*alignment = -1; *alignment = -1;
return FALSE; return FALSE;
} }
_gi_ir_node_compute_offsets (build, iface); gi_ir_node_compute_offsets (build, iface);
switch (iface->type) switch (iface->type)
{ {
@ -252,7 +252,7 @@ get_interface_size_alignment (GIIrTypelibBuild *build,
{ {
g_warning ("%s has is not a pointer and is of type %s", g_warning ("%s has is not a pointer and is of type %s",
who, who,
_gi_ir_node_type_to_string (iface->type)); gi_ir_node_type_to_string (iface->type));
*size = -1; *size = -1;
*alignment = -1; *alignment = -1;
break; break;
@ -502,7 +502,7 @@ check_needs_computation (GIIrTypelibBuild *build,
} }
/* /*
* _gi_ir_node_compute_offsets: * gi_ir_node_compute_offsets:
* @build: Current typelib build * @build: Current typelib build
* @node: a #GIIrNode * @node: a #GIIrNode
* *
@ -511,8 +511,8 @@ check_needs_computation (GIIrTypelibBuild *build,
* alignment for the type. * alignment for the type.
*/ */
void void
_gi_ir_node_compute_offsets (GIIrTypelibBuild *build, gi_ir_node_compute_offsets (GIIrTypelibBuild *build,
GIIrNode *node) GIIrNode *node)
{ {
gboolean appended_stack; gboolean appended_stack;

View File

@ -31,19 +31,19 @@ G_BEGIN_DECLS
typedef struct _GIIrParser GIIrParser; typedef struct _GIIrParser GIIrParser;
GIIrParser *_gi_ir_parser_new (void); GIIrParser *gi_ir_parser_new (void);
void _gi_ir_parser_free (GIIrParser *parser); void gi_ir_parser_free (GIIrParser *parser);
void _gi_ir_parser_set_includes (GIIrParser *parser, void gi_ir_parser_set_includes (GIIrParser *parser,
const gchar *const *includes); const gchar *const *includes);
GIIrModule *_gi_ir_parser_parse_string (GIIrParser *parser, GIIrModule *gi_ir_parser_parse_string (GIIrParser *parser,
const gchar *namespace, const gchar *namespace,
const gchar *filename, const gchar *filename,
const gchar *buffer, const gchar *buffer,
gssize length, gssize length,
GError **error); GError **error);
GIIrModule *_gi_ir_parser_parse_file (GIIrParser *parser, GIIrModule *gi_ir_parser_parse_file (GIIrParser *parser,
const gchar *filename, const gchar *filename,
GError **error); GError **error);
G_END_DECLS G_END_DECLS

View File

@ -183,7 +183,7 @@ static const gchar *find_attribute (const gchar *name,
GIIrParser * GIIrParser *
_gi_ir_parser_new (void) gi_ir_parser_new (void)
{ {
GIIrParser *parser = g_slice_new0 (GIIrParser); GIIrParser *parser = g_slice_new0 (GIIrParser);
const char *gi_gir_path = g_getenv ("GI_GIR_PATH"); const char *gi_gir_path = g_getenv ("GI_GIR_PATH");
@ -195,7 +195,7 @@ _gi_ir_parser_new (void)
} }
void void
_gi_ir_parser_free (GIIrParser *parser) gi_ir_parser_free (GIIrParser *parser)
{ {
GList *l; GList *l;
@ -203,14 +203,14 @@ _gi_ir_parser_free (GIIrParser *parser)
g_strfreev (parser->gi_gir_path); g_strfreev (parser->gi_gir_path);
for (l = parser->parsed_modules; l; l = l->next) for (l = parser->parsed_modules; l; l = l->next)
_gi_ir_module_free (l->data); gi_ir_module_free (l->data);
g_slice_free (GIIrParser, parser); g_slice_free (GIIrParser, parser);
} }
void void
_gi_ir_parser_set_includes (GIIrParser *parser, gi_ir_parser_set_includes (GIIrParser *parser,
const gchar *const *includes) const gchar *const *includes)
{ {
g_strfreev (parser->includes); g_strfreev (parser->includes);
@ -541,7 +541,7 @@ parse_type_internal (GIIrModule *module,
GIIrNodeType *type; GIIrNodeType *type;
char *temporary_type = NULL; char *temporary_type = NULL;
type = (GIIrNodeType *)_gi_ir_node_new (GI_IR_NODE_TYPE, module); type = (GIIrNodeType *)gi_ir_node_new (GI_IR_NODE_TYPE, module);
type->unparsed = g_strdup (str); type->unparsed = g_strdup (str);
@ -670,7 +670,7 @@ parse_type_internal (GIIrModule *module,
return type; return type;
/* error: */ /* error: */
_gi_ir_node_free ((GIIrNode *)type); gi_ir_node_free ((GIIrNode *)type);
g_free (temporary_type); g_free (temporary_type);
return NULL; return NULL;
} }
@ -835,8 +835,8 @@ start_glib_boxed (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
boxed = (GIIrNodeBoxed *) _gi_ir_node_new (GI_IR_NODE_BOXED, boxed = (GIIrNodeBoxed *) gi_ir_node_new (GI_IR_NODE_BOXED,
ctx->current_module); ctx->current_module);
((GIIrNode *)boxed)->name = g_strdup (name); ((GIIrNode *)boxed)->name = g_strdup (name);
boxed->gtype_name = g_strdup (typename); boxed->gtype_name = g_strdup (typename);
@ -933,8 +933,8 @@ start_function (GMarkupParseContext *context,
if (shadows) if (shadows)
name = shadows; name = shadows;
function = (GIIrNodeFunction *) _gi_ir_node_new (GI_IR_NODE_FUNCTION, function = (GIIrNodeFunction *) gi_ir_node_new (GI_IR_NODE_FUNCTION,
ctx->current_module); ctx->current_module);
((GIIrNode *)function)->name = g_strdup (name); ((GIIrNode *)function)->name = g_strdup (name);
function->symbol = g_strdup (symbol); function->symbol = g_strdup (symbol);
@ -1237,8 +1237,8 @@ start_parameter (GMarkupParseContext *context,
if (name == NULL) if (name == NULL)
name = "unknown"; name = "unknown";
param = (GIIrNodeParam *)_gi_ir_node_new (GI_IR_NODE_PARAM, param = (GIIrNodeParam *)gi_ir_node_new (GI_IR_NODE_PARAM,
ctx->current_module); ctx->current_module);
ctx->current_typed = (GIIrNode*) param; ctx->current_typed = (GIIrNode*) param;
ctx->current_typed->name = g_strdup (name); ctx->current_typed->name = g_strdup (name);
@ -1408,8 +1408,8 @@ start_field (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
field = (GIIrNodeField *)_gi_ir_node_new (GI_IR_NODE_FIELD, field = (GIIrNodeField *)gi_ir_node_new (GI_IR_NODE_FIELD,
ctx->current_module); ctx->current_module);
if (introspectable) if (introspectable)
{ {
ctx->current_typed = (GIIrNode*) field; ctx->current_typed = (GIIrNode*) field;
@ -1475,8 +1475,8 @@ start_field (GMarkupParseContext *context,
{ {
GIIrNodeConstant *constant; GIIrNodeConstant *constant;
constant = (GIIrNodeConstant *) _gi_ir_node_new (GI_IR_NODE_CONSTANT, constant = (GIIrNodeConstant *) gi_ir_node_new (GI_IR_NODE_CONSTANT,
ctx->current_module); ctx->current_module);
((GIIrNode *)constant)->name = g_strdup (name); ((GIIrNode *)constant)->name = g_strdup (name);
constant->value = g_strdup (branch); constant->value = g_strdup (branch);
constant->type = union_->discriminator_type; constant->type = union_->discriminator_type;
@ -1551,11 +1551,11 @@ start_enum (GMarkupParseContext *context,
} }
if (strcmp (element_name, "enumeration") == 0) if (strcmp (element_name, "enumeration") == 0)
enum_ = (GIIrNodeEnum *) _gi_ir_node_new (GI_IR_NODE_ENUM, enum_ = (GIIrNodeEnum *) gi_ir_node_new (GI_IR_NODE_ENUM,
ctx->current_module); ctx->current_module);
else else
enum_ = (GIIrNodeEnum *) _gi_ir_node_new (GI_IR_NODE_FLAGS, enum_ = (GIIrNodeEnum *) gi_ir_node_new (GI_IR_NODE_FLAGS,
ctx->current_module); ctx->current_module);
((GIIrNode *)enum_)->name = g_strdup (name); ((GIIrNode *)enum_)->name = g_strdup (name);
enum_->gtype_name = g_strdup (typename); enum_->gtype_name = g_strdup (typename);
enum_->gtype_init = g_strdup (typeinit); enum_->gtype_init = g_strdup (typeinit);
@ -1624,8 +1624,8 @@ start_property (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
property = (GIIrNodeProperty *) _gi_ir_node_new (GI_IR_NODE_PROPERTY, property = (GIIrNodeProperty *) gi_ir_node_new (GI_IR_NODE_PROPERTY,
ctx->current_module); ctx->current_module);
ctx->current_typed = (GIIrNode*) property; ctx->current_typed = (GIIrNode*) property;
((GIIrNode *)property)->name = g_strdup (name); ((GIIrNode *)property)->name = g_strdup (name);
@ -1712,8 +1712,8 @@ start_member (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
value_ = (GIIrNodeValue *) _gi_ir_node_new (GI_IR_NODE_VALUE, value_ = (GIIrNodeValue *) gi_ir_node_new (GI_IR_NODE_VALUE,
ctx->current_module); ctx->current_module);
((GIIrNode *)value_)->name = g_strdup (name); ((GIIrNode *)value_)->name = g_strdup (name);
@ -1790,8 +1790,8 @@ start_constant (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
constant = (GIIrNodeConstant *) _gi_ir_node_new (GI_IR_NODE_CONSTANT, constant = (GIIrNodeConstant *) gi_ir_node_new (GI_IR_NODE_CONSTANT,
ctx->current_module); ctx->current_module);
((GIIrNode *)constant)->name = g_strdup (name); ((GIIrNode *)constant)->name = g_strdup (name);
constant->value = g_strdup (value); constant->value = g_strdup (value);
@ -1864,8 +1864,8 @@ start_interface (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
iface = (GIIrNodeInterface *) _gi_ir_node_new (GI_IR_NODE_INTERFACE, iface = (GIIrNodeInterface *) gi_ir_node_new (GI_IR_NODE_INTERFACE,
ctx->current_module); ctx->current_module);
((GIIrNode *)iface)->name = g_strdup (name); ((GIIrNode *)iface)->name = g_strdup (name);
iface->gtype_name = g_strdup (typename); iface->gtype_name = g_strdup (typename);
iface->gtype_init = g_strdup (typeinit); iface->gtype_init = g_strdup (typeinit);
@ -1942,8 +1942,8 @@ start_class (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
iface = (GIIrNodeInterface *) _gi_ir_node_new (GI_IR_NODE_OBJECT, iface = (GIIrNodeInterface *) gi_ir_node_new (GI_IR_NODE_OBJECT,
ctx->current_module); ctx->current_module);
((GIIrNode *)iface)->name = g_strdup (name); ((GIIrNode *)iface)->name = g_strdup (name);
iface->gtype_name = g_strdup (typename); iface->gtype_name = g_strdup (typename);
iface->gtype_init = g_strdup (typeinit); iface->gtype_init = g_strdup (typeinit);
@ -2080,8 +2080,8 @@ start_type (GMarkupParseContext *context,
const char *len; const char *len;
const char *size; const char *size;
typenode = (GIIrNodeType *)_gi_ir_node_new (GI_IR_NODE_TYPE, typenode = (GIIrNodeType *)gi_ir_node_new (GI_IR_NODE_TYPE,
ctx->current_module); ctx->current_module);
typenode->tag = GI_TYPE_TAG_ARRAY; typenode->tag = GI_TYPE_TAG_ARRAY;
typenode->is_pointer = TRUE; typenode->is_pointer = TRUE;
@ -2359,8 +2359,8 @@ start_return_value (GMarkupParseContext *context,
ctx->state == STATE_FUNCTION)) ctx->state == STATE_FUNCTION))
return FALSE; return FALSE;
param = (GIIrNodeParam *)_gi_ir_node_new (GI_IR_NODE_PARAM, param = (GIIrNodeParam *)gi_ir_node_new (GI_IR_NODE_PARAM,
ctx->current_module); ctx->current_module);
param->in = FALSE; param->in = FALSE;
param->out = FALSE; param->out = FALSE;
param->retval = TRUE; param->retval = TRUE;
@ -2480,8 +2480,8 @@ start_glib_signal (GMarkupParseContext *context,
MISSING_ATTRIBUTE (context, error, element_name, "name"); MISSING_ATTRIBUTE (context, error, element_name, "name");
return FALSE; return FALSE;
} }
signal = (GIIrNodeSignal *)_gi_ir_node_new (GI_IR_NODE_SIGNAL, signal = (GIIrNodeSignal *)gi_ir_node_new (GI_IR_NODE_SIGNAL,
ctx->current_module); ctx->current_module);
((GIIrNode *)signal)->name = g_strdup (name); ((GIIrNode *)signal)->name = g_strdup (name);
@ -2564,8 +2564,8 @@ start_vfunc (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
vfunc = (GIIrNodeVFunc *)_gi_ir_node_new (GI_IR_NODE_VFUNC, vfunc = (GIIrNodeVFunc *)gi_ir_node_new (GI_IR_NODE_VFUNC,
ctx->current_module); ctx->current_module);
((GIIrNode *)vfunc)->name = g_strdup (name); ((GIIrNode *)vfunc)->name = g_strdup (name);
@ -2674,8 +2674,8 @@ start_struct (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
struct_ = (GIIrNodeStruct *) _gi_ir_node_new (GI_IR_NODE_STRUCT, struct_ = (GIIrNodeStruct *) gi_ir_node_new (GI_IR_NODE_STRUCT,
ctx->current_module); ctx->current_module);
((GIIrNode *)struct_)->name = g_strdup (name ? name : ""); ((GIIrNode *)struct_)->name = g_strdup (name ? name : "");
if (deprecated) if (deprecated)
@ -2748,8 +2748,8 @@ start_union (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
union_ = (GIIrNodeUnion *) _gi_ir_node_new (GI_IR_NODE_UNION, union_ = (GIIrNodeUnion *) gi_ir_node_new (GI_IR_NODE_UNION,
ctx->current_module); ctx->current_module);
((GIIrNode *)union_)->name = g_strdup (name ? name : ""); ((GIIrNode *)union_)->name = g_strdup (name ? name : "");
union_->gtype_name = g_strdup (typename); union_->gtype_name = g_strdup (typename);
@ -2859,7 +2859,7 @@ parse_include (GMarkupParseContext *context,
return FALSE; return FALSE;
} }
module = _gi_ir_parser_parse_string (ctx->parser, name, girpath, buffer, length, &error); module = gi_ir_parser_parse_string (ctx->parser, name, girpath, buffer, length, &error);
g_free (buffer); g_free (buffer);
if (error != NULL) if (error != NULL)
{ {
@ -3106,7 +3106,7 @@ start_element_handler (GMarkupParseContext *context,
"<namespace/> name element '%s' doesn't match file name '%s'", "<namespace/> name element '%s' doesn't match file name '%s'",
name, ctx->namespace); name, ctx->namespace);
ctx->current_module = _gi_ir_module_new (name, version, shared_library, cprefix); ctx->current_module = gi_ir_module_new (name, version, shared_library, cprefix);
ctx->current_module->aliases = ctx->aliases; ctx->current_module->aliases = ctx->aliases;
ctx->aliases = NULL; ctx->aliases = NULL;
@ -3116,7 +3116,7 @@ start_element_handler (GMarkupParseContext *context,
ctx->pointer_structures = NULL; ctx->pointer_structures = NULL;
for (l = ctx->include_modules; l; l = l->next) for (l = ctx->include_modules; l; l = l->next)
_gi_ir_module_add_include_module (ctx->current_module, l->data); gi_ir_module_add_include_module (ctx->current_module, l->data);
g_list_free (ctx->include_modules); g_list_free (ctx->include_modules);
ctx->include_modules = NULL; ctx->include_modules = NULL;
@ -3663,7 +3663,7 @@ cleanup (GMarkupParseContext *context,
GList *m; GList *m;
for (m = ctx->modules; m; m = m->next) for (m = ctx->modules; m; m = m->next)
_gi_ir_module_free (m->data); gi_ir_module_free (m->data);
g_list_free (ctx->modules); g_list_free (ctx->modules);
ctx->modules = NULL; ctx->modules = NULL;
@ -3671,7 +3671,7 @@ cleanup (GMarkupParseContext *context,
} }
/** /**
* _gi_ir_parser_parse_string: * gi_ir_parser_parse_string:
* @parser: a #GIIrParser * @parser: a #GIIrParser
* @namespace: the namespace of the string * @namespace: the namespace of the string
* @filename: (allow-none): Path to parsed file, or %NULL * @filename: (allow-none): Path to parsed file, or %NULL
@ -3685,12 +3685,12 @@ cleanup (GMarkupParseContext *context,
* Returns: (transfer none): a new #GirModule * Returns: (transfer none): a new #GirModule
*/ */
GIIrModule * GIIrModule *
_gi_ir_parser_parse_string (GIIrParser *parser, gi_ir_parser_parse_string (GIIrParser *parser,
const gchar *namespace, const gchar *namespace,
const gchar *filename, const gchar *filename,
const gchar *buffer, const gchar *buffer,
gssize length, gssize length,
GError **error) GError **error)
{ {
ParseContext ctx = { 0 }; ParseContext ctx = { 0 };
GMarkupParseContext *context; GMarkupParseContext *context;
@ -3755,7 +3755,7 @@ _gi_ir_parser_parse_string (GIIrParser *parser,
} }
/** /**
* _gi_ir_parser_parse_file: * gi_ir_parser_parse_file:
* @parser: a #GIIrParser * @parser: a #GIIrParser
* @filename: filename to parse * @filename: filename to parse
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
@ -3767,9 +3767,9 @@ _gi_ir_parser_parse_string (GIIrParser *parser,
* are owned by the #GIIrParser and will be freed along with the parser. * are owned by the #GIIrParser and will be freed along with the parser.
*/ */
GIIrModule * GIIrModule *
_gi_ir_parser_parse_file (GIIrParser *parser, gi_ir_parser_parse_file (GIIrParser *parser,
const gchar *filename, const gchar *filename,
GError **error) GError **error)
{ {
gchar *buffer; gchar *buffer;
gsize length; gsize length;
@ -3803,7 +3803,7 @@ _gi_ir_parser_parse_file (GIIrParser *parser,
return NULL; return NULL;
} }
module = _gi_ir_parser_parse_string (parser, namespace, filename, buffer, length, error); module = gi_ir_parser_parse_string (parser, namespace, filename, buffer, length, error);
g_free (namespace); g_free (namespace);

View File

@ -212,7 +212,7 @@ gi_struct_info_find_method (GIStructInfo *info,
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset]; StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
offset = gi_struct_get_field_offset (info, blob->n_fields); offset = gi_struct_get_field_offset (info, blob->n_fields);
return _gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name); return gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
} }
/** /**

View File

@ -146,9 +146,9 @@ gi_type_info_get_param_type (GITypeInfo *info,
case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_GHASH:
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + sizeof (ParamTypeBlob) rinfo->offset + sizeof (ParamTypeBlob)
+ sizeof (SimpleTypeBlob) * n); + sizeof (SimpleTypeBlob) * n);
break; break;
default: default:
break; break;
@ -207,7 +207,7 @@ gi_type_info_get_interface (GITypeInfo *info)
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset]; InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_INTERFACE) if (blob->tag == GI_TYPE_TAG_INTERFACE)
return _gi_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface); return gi_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface);
} }
} }

View File

@ -1332,19 +1332,19 @@ AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
*/ */
typedef struct _GITypelibHashBuilder GITypelibHashBuilder; typedef struct _GITypelibHashBuilder GITypelibHashBuilder;
GITypelibHashBuilder * _gi_typelib_hash_builder_new (void); GITypelibHashBuilder * gi_typelib_hash_builder_new (void);
void _gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value); void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value);
gboolean _gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder); gboolean gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
guint32 _gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder); guint32 gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
void _gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size); void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size);
void _gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder); void gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
guint16 _gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries); guint16 gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries);
G_END_DECLS G_END_DECLS

View File

@ -209,7 +209,7 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
guint8 *hash = (guint8*) &typelib->data[dirindex->offset]; guint8 *hash = (guint8*) &typelib->data[dirindex->offset];
guint16 index; guint16 index;
index = _gi_typelib_hash_search (hash, name, n_entries); index = gi_typelib_hash_search (hash, name, n_entries);
entry = gi_typelib_get_dir_entry (typelib, index + 1); entry = gi_typelib_get_dir_entry (typelib, index + 1);
entry_name = gi_typelib_get_string (typelib, entry->name); entry_name = gi_typelib_get_string (typelib, entry->name);
if (strcmp (name, entry_name) == 0) if (strcmp (name, entry_name) == 0)
@ -2298,7 +2298,7 @@ load_one_shared_library (const char *shlib)
} }
static void static void
_gi_typelib_do_dlopen (GITypelib *typelib) gi_typelib_do_dlopen (GITypelib *typelib)
{ {
Header *header; Header *header;
const char *shlib_str; const char *shlib_str;
@ -2357,12 +2357,12 @@ _gi_typelib_do_dlopen (GITypelib *typelib)
} }
static inline void static inline void
_gi_typelib_ensure_open (GITypelib *typelib) gi_typelib_ensure_open (GITypelib *typelib)
{ {
if (typelib->open_attempted) if (typelib->open_attempted)
return; return;
typelib->open_attempted = TRUE; typelib->open_attempted = TRUE;
_gi_typelib_do_dlopen (typelib); gi_typelib_do_dlopen (typelib);
} }
/** /**
@ -2505,7 +2505,7 @@ gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol
{ {
GList *l; GList *l;
_gi_typelib_ensure_open (typelib); gi_typelib_ensure_open (typelib);
/* /*
* The reason for having multiple modules dates from gir-repository * The reason for having multiple modules dates from gir-repository

View File

@ -173,7 +173,7 @@ gi_union_info_get_discriminator_type (GIUnionInfo *info)
{ {
GIRealInfo *rinfo = (GIRealInfo *)info; GIRealInfo *rinfo = (GIRealInfo *)info;
return _gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24); return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
} }
/** /**
@ -234,7 +234,7 @@ gi_union_info_find_method (GIUnionInfo *info,
offset = rinfo->offset + header->union_blob_size offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size; + blob->n_fields * header->field_blob_size;
return _gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_functions, name); return gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_functions, name);
} }
/** /**

View File

@ -45,10 +45,10 @@
*/ */
GIVFuncInfo * GIVFuncInfo *
_gi_base_info_find_vfunc (GIRealInfo *rinfo, gi_base_info_find_vfunc (GIRealInfo *rinfo,
guint32 offset, guint32 offset,
gint n_vfuncs, gint n_vfuncs,
const gchar *name) const gchar *name)
{ {
/* FIXME hash */ /* FIXME hash */
Header *header = (Header *)rinfo->typelib->data; Header *header = (Header *)rinfo->typelib->data;

View File

@ -31,28 +31,28 @@ test_build_retrieve (void)
guint32 bufsize; guint32 bufsize;
guint8* buf; guint8* buf;
builder = _gi_typelib_hash_builder_new (); builder = gi_typelib_hash_builder_new ();
_gi_typelib_hash_builder_add_string (builder, "Action", 0); gi_typelib_hash_builder_add_string (builder, "Action", 0);
_gi_typelib_hash_builder_add_string (builder, "ZLibDecompressor", 42); gi_typelib_hash_builder_add_string (builder, "ZLibDecompressor", 42);
_gi_typelib_hash_builder_add_string (builder, "VolumeMonitor", 9); gi_typelib_hash_builder_add_string (builder, "VolumeMonitor", 9);
_gi_typelib_hash_builder_add_string (builder, "FileMonitorFlags", 31); gi_typelib_hash_builder_add_string (builder, "FileMonitorFlags", 31);
if (!_gi_typelib_hash_builder_prepare (builder)) if (!gi_typelib_hash_builder_prepare (builder))
g_assert_not_reached (); g_assert_not_reached ();
bufsize = _gi_typelib_hash_builder_get_buffer_size (builder); bufsize = gi_typelib_hash_builder_get_buffer_size (builder);
buf = g_malloc (bufsize); buf = g_malloc (bufsize);
_gi_typelib_hash_builder_pack (builder, buf, bufsize); gi_typelib_hash_builder_pack (builder, buf, bufsize);
_gi_typelib_hash_builder_destroy (builder); gi_typelib_hash_builder_destroy (builder);
g_assert (_gi_typelib_hash_search (buf, "Action", 4) == 0); g_assert (gi_typelib_hash_search (buf, "Action", 4) == 0);
g_assert (_gi_typelib_hash_search (buf, "ZLibDecompressor", 4) == 42); g_assert (gi_typelib_hash_search (buf, "ZLibDecompressor", 4) == 42);
g_assert (_gi_typelib_hash_search (buf, "VolumeMonitor", 4) == 9); g_assert (gi_typelib_hash_search (buf, "VolumeMonitor", 4) == 9);
g_assert (_gi_typelib_hash_search (buf, "FileMonitorFlags", 4) == 31); g_assert (gi_typelib_hash_search (buf, "FileMonitorFlags", 4) == 31);
} }
int int

View File

@ -64,7 +64,7 @@ struct _GITypelibHashBuilder {
}; };
GITypelibHashBuilder * GITypelibHashBuilder *
_gi_typelib_hash_builder_new (void) gi_typelib_hash_builder_new (void)
{ {
GITypelibHashBuilder *builder = g_slice_new0 (GITypelibHashBuilder); GITypelibHashBuilder *builder = g_slice_new0 (GITypelibHashBuilder);
builder->c = NULL; builder->c = NULL;
@ -73,16 +73,16 @@ _gi_typelib_hash_builder_new (void)
} }
void void
_gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder,
const char *str, const char *str,
guint16 value) guint16 value)
{ {
g_return_if_fail (builder->c == NULL); g_return_if_fail (builder->c == NULL);
g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER ((guint) value)); g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER ((guint) value));
} }
gboolean gboolean
_gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder) gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
{ {
char **strs; char **strs;
GHashTableIter hashiter; GHashTableIter hashiter;
@ -137,7 +137,7 @@ _gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
} }
guint32 guint32
_gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder) gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
{ {
g_return_val_if_fail (builder != NULL, 0); g_return_val_if_fail (builder != NULL, 0);
g_return_val_if_fail (builder->prepared, 0); g_return_val_if_fail (builder->prepared, 0);
@ -147,7 +147,7 @@ _gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
} }
void void
_gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 len) gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 len)
{ {
guint16 *table; guint16 *table;
GHashTableIter hashiter; GHashTableIter hashiter;
@ -185,7 +185,7 @@ _gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint
} }
void void
_gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder) gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder)
{ {
if (builder->c) if (builder->c)
{ {
@ -197,7 +197,7 @@ _gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder)
} }
guint16 guint16
_gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries) gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries)
{ {
guint32 *mph; guint32 *mph;
guint16 *table; guint16 *table;