Some fields (eg. data) may not be properly initialized.
Use calloc() instead of malloc() will ensure proper initialization
even if we add more fields.
These fields (data) would even be passed down to Evas as
Evas_Event_Key_Down for instance.
if (!compose) compose = compose_buffer;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
((compose[0] != '\0') ? strlen(compose) : 0) + 3);
if (!e) return;
e->timestamp = timestamp;
e->same_screen = 1;
e->keycode = code;
- e->data = NULL;
_device_modifiers_update(edev);
u16 utf16;
unsigned int i;
- ev = malloc(sizeof(Ecore_Event_Key));
+ ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return NULL;
ev->timestamp = _ecore_psl1ght_get_time ();
{
Ecore_Event_Key *ev = NULL;
- ev = malloc(sizeof(Ecore_Event_Key));
+ ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
Ecore_Event_Key *ev;
unsigned int i;
- ev = malloc(sizeof(Ecore_Event_Key));
+ ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return NULL;
ev->timestamp = timestamp;
_ecore_wl_input_keymap_translate_keysym(sym, input->modifiers,
compose, sizeof(compose));
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
((compose[0] != '\0') ? strlen(compose) : 0) + 3);
if (!e) return;
key = _ecore_xcb_keymap_keysym_to_string(sym);
if (!key) key = keyname;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
(compose ? strlen(compose) : 0) + 3);
if (e)
{
e->keyname = (char *)(e + 1);
e->key = e->keyname + strlen(keyname) + 1;
- e->compose = NULL;
if (compose) e->compose = (e->key + strlen(key) + 1);
e->string = e->compose;
key = _ecore_xcb_keymap_keysym_to_string(sym);
if (!key) key = keyname;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
(compose ? strlen(compose) : 0) + 3);
if (e)
{
e->keyname = (char *)(e + 1);
e->key = e->keyname + strlen(keyname) + 1;
- e->compose = NULL;
if (compose) e->compose = (e->key + strlen(key) + 1);
e->string = e->compose;
if (!key)
key = keyname;
- e =
- malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
- (compose ? strlen(compose) : 0) + 3);
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ (compose ? strlen(compose) : 0) + 3);
if (!e)
goto on_error;
"key event (key: %s)",
keyname);
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
+ e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
strlen(string) + 3);
if (!e) return;