OSDN Git Service

Compiled out conditionally debug-oriented code
authorJean-Pierre André <jpandre@users.sourceforge.net>
Wed, 22 Jun 2016 10:01:25 +0000 (12:01 +0200)
committerJean-Pierre André <jpandre@users.sourceforge.net>
Wed, 22 Jun 2016 10:01:25 +0000 (12:01 +0200)
Although ntfs_log_trace() is defined to a no-op in non-DEBUG builds,
ntfs_attr_name_get() is not.  This function performs a string conversion
and a memory allocation, so it is nice to have the call to it compiled
out when not needed.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
libntfs-3g/dir.c

index bd049d2..6e97ee7 100644 (file)
@@ -1906,17 +1906,21 @@ int ntfs_delete(ntfs_volume *vol, const char *pathname,
 search:
        while (!(err = ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0,
                                        CASE_SENSITIVE, 0, NULL, 0, actx))) {
+       #ifdef DEBUG
                char *s;
+       #endif
                IGNORE_CASE_BOOL case_sensitive = IGNORE_CASE;
 
                fn = (FILE_NAME_ATTR*)((u8*)actx->attr +
                                le16_to_cpu(actx->attr->value_offset));
+       #ifdef DEBUG
                s = ntfs_attr_name_get(fn->file_name, fn->file_name_length);
                ntfs_log_trace("name: '%s'  type: %d  dos: %d  win32: %d  "
                               "case: %d\n", s, fn->file_name_type,
                               looking_for_dos_name, looking_for_win32_name,
                               case_sensitive_match);
                ntfs_attr_name_free(&s);
+       #endif
                if (looking_for_dos_name) {
                        if (fn->file_name_type == FILE_NAME_DOS)
                                break;