small optimizations for shadowcopy2 module
authorChristian Ambach <christian.ambach@de.ibm.com>
Wed, 21 Apr 2010 13:10:39 +0000 (15:10 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 4 Aug 2010 11:56:12 +0000 (13:56 +0200)
- remove a compiler warning
- replace strlen usage

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
source3/modules/vfs_shadow_copy2.c

index 34792de97b4d60fa7e53a317d084d9b46cf3bd98..502f815235cd74aa0176aec17dcd64a4e624af6d 100644 (file)
@@ -436,7 +436,7 @@ static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname,
        }
 
        prefix = talloc_asprintf(tmp_ctx, "%s/@GMT-", snapdir);
-       if (strncmp(fname, prefix, strlen(prefix)) == 0) {
+       if (strncmp(fname, prefix, (talloc_get_size(prefix)-1)) == 0) {
                /* this looks like as we have already normalized it, leave it untouched*/
                talloc_free(tmp_ctx);
                return talloc_strdup(handle->data, fname);
@@ -659,7 +659,7 @@ static char *shadow_copy2_realpath(vfs_handle_struct *handle,
 
        if (shadow_copy2_match_name(fname, &gmt)
            && (gmt[GMT_NAME_LEN] == '\0')) {
-               char *copy, *result;
+               char *copy;
 
                copy = talloc_strdup(talloc_tos(), fname);
                if (copy == NULL) {