diff --git a/ChangeLog b/ChangeLog index 0287bd4f47..b21c236881 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-04-12 Matthias Clasen + * 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) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0287bd4f47..b21c236881 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2006-04-12 Matthias Clasen + * 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) diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c index 62742c1bc3..0fb4ae079f 100644 --- a/gdk/x11/gdkkeys-x11.c +++ b/gdk/x11/gdkkeys-x11.c @@ -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; }