[RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

GOUJON Alexandre 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[0]) 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 
const strings.

>> +    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.
Got it.
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 ?

> Vitaliy.
Many thanks, I'm avoiding try[6-9] with your advices !!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmd_v2.patch
Type: text/x-patch
Size: 6194 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20101101/6666a188/attachment.bin>

More information about the wine-devel mailing list