diff options
author | Jean Guyomarc'h <jean@guyomarch.bzh> | 2016-10-30 16:34:35 +0100 |
---|---|---|
committer | Jean Guyomarc'h <jean@guyomarch.bzh> | 2016-10-30 16:46:30 +0100 |
commit | 5c366cab268a8e6b1d11b84794277c725040d3e6 (patch) | |
tree | d282166c168953d464200001a03822a0e6c9eedb | |
parent | 4029164c8ecc301ebf055eb408b177deb278c9d9 (diff) | |
download | efl-5c366cab268a8e6b1d11b84794277c725040d3e6.tar.gz |
ecore_cocoa: prettify code a bit
Remove extraneous whitespaces, use appropriate macros when possible,
and mark a memory allocation failure as an unlikely case.
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index d180561cc5..7204f89417 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m @@ -124,13 +124,13 @@ _ecore_cocoa_event_key(NSEvent *event, DBG("Event Key, keyType : %lu", keyType); - ev = calloc(1, sizeof (Ecore_Event_Key)); - if (!ev) return NULL; + ev = calloc(1, sizeof(*ev)); + if (EINA_UNLIKELY(!ev)) return NULL; if (compose && (keyType == NSEventTypeKeyDown)) { [edit interpretKeyEvents:[NSArray arrayWithObject:event]]; - compose=EINA_FALSE; + compose = EINA_FALSE; } ev->timestamp = time; @@ -145,7 +145,7 @@ _ecore_cocoa_event_key(NSEvent *event, if ([keychar length] > 0) { - for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + for (i = 0; i < EINA_C_ARRAY_LENGTH(keystable); ++i) { if (keystable[i].code == [keychar characterAtIndex:0]) { @@ -161,10 +161,10 @@ _ecore_cocoa_event_key(NSEvent *event, } } - if (([keycharRaw length] == 0) && (keyType == NSEventTypeKeyDown)) + if (([keycharRaw length] == 0) && (keyType == NSEventTypeKeyDown)) { - compose=EINA_TRUE; - edit = [[event window] fieldEditor:YES forObject:nil]; + compose = EINA_TRUE; + edit = [[event window] fieldEditor:YES forObject:nil]; [edit interpretKeyEvents:[NSArray arrayWithObject:event]]; free(ev); return NULL; @@ -182,7 +182,7 @@ _ecore_cocoa_feed_events(void *anEvent) unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); Eina_Bool pass = EINA_FALSE; - DBG("Feed events, event type ; %lu", [event type]); + DBG("Feed events, event type ; %lx", [event type]); switch ([event type]) { |