From: Enlightenment S. <no-...@en...> - 2011-02-21 11:02:18
|
Log: Fix raster fix Use eina_strbuf_append_length, not eina_strbuf_append_n to add a string with known length. Author: englebass Date: 2011-02-21 03:02:10 -0800 (Mon, 21 Feb 2011) New Revision: 57211 Trac: http://trac.enlightenment.org/e/changeset/57211 Modified: trunk/e/src/bin/e_acpi.c Modified: trunk/e/src/bin/e_acpi.c =================================================================== --- trunk/e/src/bin/e_acpi.c 2011-02-21 08:04:44 UTC (rev 57210) +++ trunk/e/src/bin/e_acpi.c 2011-02-21 11:02:10 UTC (rev 57211) @@ -184,13 +184,13 @@ Ecore_Con_Event_Server_Data *ev; E_Event_Acpi *acpi_event; int sig, status, i, done = 0; - char device[1024], bus[1024], *sdata, *stmp; + char device[1024], bus[1024], *sdata; const char *str, *p; ev = event; if ((!ev->data) || (ev->size < 1)) return ECORE_CALLBACK_PASS_ON; - + /* write out actual acpi received data to stdout for debugging res = fwrite(ev->data, ev->size, 1, stdout); */ @@ -198,10 +198,7 @@ * a blob of data. copy to string and 0 byte terminate it so it can be * string-swizzled/parsed etc. */ if (!acpibuf) acpibuf = eina_strbuf_new(); - stmp = alloca(ev->size + 1); - memcpy(stmp, ev->data, ev->size); - stmp[ev->size] = 0; - eina_strbuf_append_n(acpibuf, stmp, ev->size); + eina_strbuf_append_length(acpibuf, ev->data, ev->size); str = eina_strbuf_string_get(acpibuf); p = strchr(str, '\n'); if (!p) return ECORE_CALLBACK_PASS_ON; |