Switch use of primitive glib types to c99 equivalents

The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.

Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.

Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.

So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.

Instead of gsize we now use size_t

For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
This commit is contained in:
Robert Bragg
2012-04-16 21:56:40 +01:00
parent 09642a83b5
commit 54735dec84
252 changed files with 2090 additions and 2048 deletions

View File

@ -89,16 +89,16 @@ GHashTable *_cogl_debug_instances;
static void
_cogl_parse_debug_string_for_keys (const char *value,
gboolean enable,
CoglBool enable,
const GDebugKey *keys,
unsigned int nkeys)
{
int long_num, key_num;
/* g_parse_debug_string expects the value field in GDebugKey to be a
mask in a guint but the flags is stored in an array of multiple
longs so we need to build a separate array for each possible
guint */
mask in an unsigned int but the flags are stored in an array of
multiple longs so we need to build a separate array for each
possible unsigned int */
for (long_num = 0; long_num < COGL_DEBUG_N_LONGS; long_num++)
{
@ -147,8 +147,8 @@ _cogl_parse_debug_string_for_keys (const char *value,
void
_cogl_parse_debug_string (const char *value,
gboolean enable,
gboolean ignore_help)
CoglBool enable,
CoglBool ignore_help)
{
if (ignore_help && strcmp (value, "help") == 0)
return;
@ -197,10 +197,10 @@ _cogl_parse_debug_string (const char *value,
}
#ifdef COGL_ENABLE_DEBUG
static gboolean
static CoglBool
cogl_arg_debug_cb (const char *key,
const char *value,
gpointer user_data)
void *user_data)
{
_cogl_parse_debug_string (value,
TRUE /* enable the flags */,
@ -208,10 +208,10 @@ cogl_arg_debug_cb (const char *key,
return TRUE;
}
static gboolean
static CoglBool
cogl_arg_no_debug_cb (const char *key,
const char *value,
gpointer user_data)
void *user_data)
{
_cogl_parse_debug_string (value,
FALSE, /* disable the flags */
@ -254,11 +254,11 @@ _cogl_debug_check_environment (void)
}
}
static gboolean
pre_parse_hook (GOptionContext *context,
GOptionGroup *group,
gpointer data,
GError **error)
static CoglBool
pre_parse_hook (GOptionContext *context,
GOptionGroup *group,
void *data,
GError **error)
{
_cogl_init ();