Compiled out conditionally debug-oriented code

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>
pull/2/head
Jean-Pierre André 2016-06-22 12:01:25 +02:00
parent 5693341f0d
commit b973c0bd3c
1 changed files with 4 additions and 0 deletions

View 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;