[PATCH 11/12] build: Removed duplicated code form s3/torture

Andrzej Hajda andrzej.hajda at wp.pl
Wed Oct 10 02:34:32 MDT 2012


On 09.10.2012 23:24, Andrew Bartlett wrote:
> On Tue, 2012-10-09 at 22:59 +0200, Andrzej Hajda wrote:
>> Signed-off-by: Andrzej Hajda <andrzej.hajda at wp.pl>
>> ---
>>   source3/torture/torture.c |   32 --------------------------------
>>   source3/wscript_build     |    1 +
>>   2 files changed, 1 insertion(+), 32 deletions(-)
>>
>> diff --git a/source3/torture/torture.c b/source3/torture/torture.c
>> index 0cca680..f952301 100644
>> --- a/source3/torture/torture.c
>> +++ b/source3/torture/torture.c
>> @@ -298,38 +298,6 @@ terminate_path_at_separator(char * path)
>>   	return NULL;
>>   }
>>
>> -/*
>> -  parse a //server/share type UNC name
>> -*/
>> -bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
>> -		      char **hostname, char **sharename)
>> -{
>> -	char *p;
>> -
>> -	*hostname = *sharename = NULL;
>> -
>> -	if (strncmp(unc_name, "\\\\", 2) &&
>> -	    strncmp(unc_name, "//", 2)) {
>> -		return False;
>> -	}
>> -
>> -	*hostname = talloc_strdup(mem_ctx, &unc_name[2]);
>> -	p = terminate_path_at_separator(*hostname);
>> -
>> -	if (p && *p) {
>> -		*sharename = talloc_strdup(mem_ctx, p);
>> -		terminate_path_at_separator(*sharename);
>> -	}
>> -
>> -	if (*hostname && *sharename) {
>> -		return True;
>> -	}
>> -
>> -	TALLOC_FREE(*hostname);
>> -	TALLOC_FREE(*sharename);
>> -	return False;
>> -}
>> -
>>   static bool torture_open_connection_share(struct cli_state **c,
>>   				   const char *hostname,
>>   				   const char *sharename)
>> diff --git a/source3/wscript_build b/source3/wscript_build
>> index c4cb3c1..4b20cb9 100755
>> --- a/source3/wscript_build
>> +++ b/source3/wscript_build
>> @@ -1441,6 +1441,7 @@ bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
>>   		 NDR_OPEN_FILES
>>   		 idmap
>>                    UTIL_LSARPC
>> +                 LIBCLI_SMB
>>                    ''',
>>                    vars=locals())
>
> This looks reasonable at first glance, until you notice that LIBCLI_SMB
> is declared in source4/libcli/wscript_build and if there was a header
> declaration for this function, it would conflict with the static
> declaration you just removed.

There is header declaration in source4/libcli/libcli.h and it is 
identical with definition I have removed, in removed function there was 
no static keyword.
Anyway the body of both functions seems to be the same except some 
cosmetic differences.

>
> Did this really build without any more errors?
>
> Additionally, it clearly wouldn't build in autoconf.  You need to ensure
> the build under source3 also passes for all these changes, and either
> propose skipping some binaries there (this would need discussion) or fix
> it.
>

Hmm, I was not aware of s3/autoconf, I will look for solutions which 
will not break it.

> Andrew Bartlett
>


Andrzej Hajda



More information about the samba-technical mailing list