[RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]
ale.goujon at gmail.com
Mon Nov 1 10:23:35 CDT 2010
On 11/01/2010 03:12 PM, Vitaliy Margolen wrote:
>> + static const char escaped_space = "@space@";
>> + DWORD len_space = strlen(escaped_space);
> The better way to calculate size of a static string, which is a
> compile time calculation. strlen() call is a runtime.
The better way is ... ?
In compare_line(), sizeof(space_cmd) is used but I guess
sizeof(space_cmd/space_cmd) is more portable, isn't it ?
I thought strlen() was optimized in that case because used with a const
>> +static char* replace_escaped_spaces(const char *data, DWORD size,
>> DWORD *new_size)
>> + char *a, *b, *new_data;
>> + a = b = (char*)data;
> a, b should be "const char*" as well.
Unfortunately, I can't do that : strncpy and HeapFree complains about
>> + new_data = (char*)malloc(size*sizeof(char));
> Don't use malloc in Wine. Use HeapAlloc & co.
> This is not c++, don't need to typecast (void*) pointer.
I'll remember this for next times.
I modified my patch according to your suggestions.
I also changed the way I update new_data to simply return it (more
understandable, I think).
Can you review it again, please ?
Many thanks, I'm avoiding try[6-9] with your advices !!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6194 bytes
Desc: not available
More information about the wine-devel