From 53d980bb0e70e40a07092c07d5fbd59fc8957f49 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Apr 2013 16:38:03 -0700 Subject: [PATCH] Use an index i rather than re-using a state variable. Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider --- source3/modules/vfs_dirsort.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c index 6fe7c1841461..1c24bc95c8ff 100644 --- a/source3/modules/vfs_dirsort.c +++ b/source3/modules/vfs_dirsort.c @@ -44,7 +44,7 @@ static bool open_and_sort_dir (vfs_handle_struct *handle) { struct dirent *dp; struct stat dir_stat; - long current_pos; + unsigned int i; struct dirsort_privates *data = NULL; SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, @@ -77,15 +77,13 @@ static bool open_and_sort_dir (vfs_handle_struct *handle) if (!data->directory_list) { return false; } - current_pos = data->pos; - data->pos = 0; + i = 0; while ((dp = SMB_VFS_NEXT_READDIR(handle, data->source_directory, NULL)) != NULL) { - data->directory_list[data->pos++] = *dp; + data->directory_list[i++] = *dp; } /* Sort the directory entries by name */ - data->pos = current_pos; TYPESAFE_QSORT(data->directory_list, data->number_of_entries, compare_dirent); return true; } -- 2.34.1