mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
Refactor handling of transfer=none/shallow/full to separate function
2008-10-12 Tommi Komulainen <tommi.komulainen@iki.fi> * girepository/girparser.c (parse_param_transfer, start_parameter): Refactor handling of transfer=none/shallow/full to separate function svn path=/trunk/; revision=688
This commit is contained in:
parent
1ff932e7a1
commit
bc54751766
58
girparser.c
58
girparser.c
@ -658,6 +658,36 @@ start_function (GMarkupParseContext *context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_param_transfer (GIrNodeParam *param, const gchar *transfer)
|
||||
{
|
||||
if (transfer && strcmp (transfer, "none") == 0)
|
||||
{
|
||||
param->transfer = FALSE;
|
||||
param->shallow_transfer = FALSE;
|
||||
}
|
||||
else if (transfer && strcmp (transfer, "shallow") == 0)
|
||||
{
|
||||
param->transfer = FALSE;
|
||||
param->shallow_transfer = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (transfer)
|
||||
{
|
||||
if (strcmp (transfer, "full") != 0)
|
||||
g_warning ("Unknown transfer %s", transfer);
|
||||
else
|
||||
param->transfer = TRUE;
|
||||
}
|
||||
else if (param->in && !param->out)
|
||||
param->transfer = FALSE;
|
||||
else
|
||||
param->transfer = TRUE;
|
||||
param->shallow_transfer = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
start_parameter (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
@ -733,32 +763,8 @@ start_parameter (GMarkupParseContext *context,
|
||||
else
|
||||
param->null_ok = FALSE;
|
||||
|
||||
if (transfer && strcmp (transfer, "none") == 0)
|
||||
{
|
||||
param->transfer = FALSE;
|
||||
param->shallow_transfer = FALSE;
|
||||
}
|
||||
else if (transfer && strcmp (transfer, "shallow") == 0)
|
||||
{
|
||||
param->transfer = FALSE;
|
||||
param->shallow_transfer = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (transfer)
|
||||
{
|
||||
if (strcmp (transfer, "full") != 0)
|
||||
g_warning ("Unknown transfer %s", transfer);
|
||||
else
|
||||
param->transfer = TRUE;
|
||||
}
|
||||
else if (param->in && !param->out)
|
||||
param->transfer = FALSE;
|
||||
else
|
||||
param->transfer = TRUE;
|
||||
param->shallow_transfer = FALSE;
|
||||
}
|
||||
|
||||
parse_param_transfer (param, transfer);
|
||||
|
||||
((GIrNode *)param)->name = g_strdup (name);
|
||||
|
||||
switch (ctx->current_node->type)
|
||||
|
Loading…
Reference in New Issue
Block a user