Jakub Filak <[email protected]> writes:
> On Wednesday 15 of August 2012 21:02:44 Jiri Moskovcak wrote:
>> ---
>> src/include/problem_data.h | 1 +
>> src/lib/abrt_sock.c | 89
>> +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 82
>> insertions(+), 8 deletions(-)
>> +{
>> + int result = 1; /* error so far */
>> + int socketfd = connect_to_abrtd_socket();
>> + if (socketfd == -1)
>> {
>> VERB1 perror_msg("Can't connect to '%s'", SOCKET_FILE);
>> + return result;
>> }
>> - close(socketfd);
>> + else
>> + {
>> + GHashTableIter iter;
>> + char *name;
>> + struct problem_item *value;
>> + g_hash_table_iter_init(&iter, problem_data);
>>
>> - return result;
>> + full_write(socketfd, "PUT / HTTP/1.1\r\n\r\n", strlen("PUT /
>> HTTP/1.1\r\n\r\n")); + while (g_hash_table_iter_next(&iter,
>
> Is it necessary to use strlen() with literals? I'm not user if compiler is so
> smart to replace it with sizeof() :)
asm ("nop\nnop");
int a = strlen("test");
int b = sizeof("test") - 1;
asm ("nop\nnop");
0x0000000000400524 <+8>: nop
0x0000000000400525 <+9>: nop
0x0000000000400526 <+10>: movl $0x4,-0x4(%rbp)
0x000000000040052d <+17>: movl $0x4,-0x8(%rbp)
0x0000000000400534 <+24>: nop
0x0000000000400535 <+25>: nop
even without any optimization it's transform to numbers without calling
any functions.
--
Nikola