Rearrange the code a bit.

2006-04-12  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkkeys-x11.c (gdk_keymap_get_entries_for_keycode):
	Rearrange the code a bit.
This commit is contained in:
Matthias Clasen 2006-04-12 17:57:30 +00:00 committed by Matthias Clasen
parent 374c855496
commit 6d66ce2fc3
3 changed files with 17 additions and 27 deletions

View File

@ -1,5 +1,8 @@
2006-04-12 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkkeys-x11.c (gdk_keymap_get_entries_for_keycode):
Rearrange the code a bit.
* gtk/gtktextlayout.c (gtk_text_layout_validate_yrange):
Handle _gtk_text_line_get_data() returning NULL in all
cases. (Coverity)

View File

@ -1,5 +1,8 @@
2006-04-12 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkkeys-x11.c (gdk_keymap_get_entries_for_keycode):
Rearrange the code a bit.
* gtk/gtktextlayout.c (gtk_text_layout_validate_yrange):
Handle _gtk_text_line_get_data() returning NULL in all
cases. (Coverity)

View File

@ -1015,36 +1015,20 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
++i;
}
}
*n_entries = 0;
if (keys)
{
*n_entries = key_array->len;
*keys = (GdkKeymapKey*) g_array_free (key_array, FALSE);
}
if ((key_array && key_array->len > 0) ||
(keyval_array && keyval_array->len > 0))
if (keyvals)
{
if (keys)
*keys = (GdkKeymapKey*) key_array->data;
if (keyvals)
*keyvals = (guint*) keyval_array->data;
if (key_array)
*n_entries = key_array->len;
else
*n_entries = keyval_array->len;
*n_entries = keyval_array->len;
*keyvals = (guint*) g_array_free (keyval_array, FALSE);
}
else
{
if (keys)
*keys = NULL;
if (keyvals)
*keyvals = NULL;
*n_entries = 0;
}
if (key_array)
g_array_free (key_array, key_array->len > 0 ? FALSE : TRUE);
if (keyval_array)
g_array_free (keyval_array, keyval_array->len > 0 ? FALSE : TRUE);
return *n_entries > 0;
}