From bc3714f54e7de35bacbeb1f22851b857fcac63ac 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 (cherry picked from commit f81822166d8d41c6c3ee6f17924ebe87e4303211) --- 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 7185e5b0a6c..a3d106da22e 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) { SMB_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.11.4.GIT