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 <ebigge...@gmail.com>
---
 libntfs-3g/dir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c
index bd049d2..6e97ee7 100644
--- a/libntfs-3g/dir.c
+++ b/libntfs-3g/dir.c
@@ -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;
-- 
2.9.0


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to