mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
girepository: Move internal gi_typelib_blob_type_to_info_type() function
`GITypeInfo` isn’t defined in `libgirepository-internals`, and that was
forcing us to do some header includes which violated the layering
between `libigrepository-internals` and `libgirepository`. Fix that by
moving the helper function to the header/source where `GITypeInfo` is
defined.
This fixes commit 54f156bd63
.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
parent
75820a6941
commit
f4f38c233f
@ -31,6 +31,8 @@
|
||||
#include <girepository/girepository.h>
|
||||
#include <girepository/gitypelib.h>
|
||||
|
||||
#include "gitypelib-internal.h"
|
||||
|
||||
/* FIXME: For now, GIRealInfo is a compatibility define. This will eventually
|
||||
* be removed. */
|
||||
typedef struct _GIBaseInfo GIRealInfo;
|
||||
@ -133,6 +135,8 @@ typedef enum
|
||||
/* keep GI_INFO_TYPE_N_TYPES in sync with this */
|
||||
} GIInfoType;
|
||||
|
||||
GIInfoType gi_typelib_blob_type_to_info_type (GITypelibBlobType blob_type);
|
||||
|
||||
/**
|
||||
* GI_INFO_TYPE_N_TYPES:
|
||||
*
|
||||
|
@ -2097,3 +2097,21 @@ gi_info_type_to_string (GIInfoType type)
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
GIInfoType
|
||||
gi_typelib_blob_type_to_info_type (GITypelibBlobType blob_type)
|
||||
{
|
||||
switch (blob_type)
|
||||
{
|
||||
case BLOB_TYPE_BOXED:
|
||||
/* `BLOB_TYPE_BOXED` now always refers to a `StructBlob`, and
|
||||
* `GIRegisteredTypeInfo` (the parent type of `GIStructInfo`) has a method
|
||||
* for distinguishing whether the struct is a boxed type. So presenting
|
||||
* `BLOB_TYPE_BOXED` as its own `GIBaseInfo` subclass is not helpful.
|
||||
* See commit e28078c70cbf4a57c7dbd39626f43f9bd2674145 and
|
||||
* https://gitlab.gnome.org/GNOME/glib/-/issues/3245. */
|
||||
return GI_INFO_TYPE_STRUCT;
|
||||
default:
|
||||
return (GIInfoType) blob_type;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <gmodule.h>
|
||||
#include "girepository.h"
|
||||
#include "girepository-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -195,8 +194,6 @@ typedef enum {
|
||||
BLOB_TYPE_UNION
|
||||
} GITypelibBlobType;
|
||||
|
||||
GIInfoType gi_typelib_blob_type_to_info_type (GITypelibBlobType blob_type);
|
||||
|
||||
|
||||
#if defined (G_CAN_INLINE) && defined (G_ALWAYS_INLINE)
|
||||
|
||||
|
@ -43,24 +43,6 @@
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GITypelib, gi_typelib, gi_typelib_ref, gi_typelib_unref)
|
||||
|
||||
GIInfoType
|
||||
gi_typelib_blob_type_to_info_type (GITypelibBlobType blob_type)
|
||||
{
|
||||
switch (blob_type)
|
||||
{
|
||||
case BLOB_TYPE_BOXED:
|
||||
/* `BLOB_TYPE_BOXED` now always refers to a `StructBlob`, and
|
||||
* `GIRegisteredTypeInfo` (the parent type of `GIStructInfo`) has a method
|
||||
* for distinguishing whether the struct is a boxed type. So presenting
|
||||
* `BLOB_TYPE_BOXED` as its own `GIBaseInfo` subclass is not helpful.
|
||||
* See commit e28078c70cbf4a57c7dbd39626f43f9bd2674145 and
|
||||
* https://gitlab.gnome.org/GNOME/glib/-/issues/3245. */
|
||||
return GI_INFO_TYPE_STRUCT;
|
||||
default:
|
||||
return (GIInfoType) blob_type;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GITypelib *typelib;
|
||||
GSList *context_stack;
|
||||
|
Loading…
Reference in New Issue
Block a user