diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-07 15:19:45 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-07 15:19:45 +0200 |
commit | bbbd7cedf522e7ea9883b881370fceb91ed3d746 (patch) | |
tree | 64a54bba635ba04a1904921c587bcf15851e49da /client | |
parent | fdcaa6cb3201ef432574946976cbc981bcffac61 (diff) | |
download | mariadb-git-bbbd7cedf522e7ea9883b881370fceb91ed3d746.tar.gz |
my_dir() cleanup
* replace pointer acrobatics with a struct
* make sorting explicit: MY_DONT_SORT -> MY_WANT_SORT
(if you want something to be done - say it. fixes all places where
my_dir() was used without thinking)
* typo s/number_off_files/number_of_files/
* directory_file_name() doesn't need to be extern
* remove #ifdef __BORLANDC__
* ignore '.' and '..' entries
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 2cca53f4e74..222ecbdba6c 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3633,7 +3633,6 @@ void do_remove_files_wildcard(struct st_command *command) fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME); DBUG_PRINT("info", ("listing directory: %s", dirname)); - /* Note that my_dir sorts the list if not given any flags */ if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT | MY_WME)))) { error= 1; @@ -3648,7 +3647,7 @@ void do_remove_files_wildcard(struct st_command *command) /* Set default wild chars for wild_compare, is changed in embedded mode */ set_wild_chars(1); - for (i= 0; i < (uint) dir_info->number_off_files; i++) + for (i= 0; i < (uint) dir_info->number_of_files; i++) { file= dir_info->dir_entry + i; /* Remove only regular files, i.e. no directories etc. */ @@ -3911,17 +3910,12 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, DBUG_ENTER("get_list_files"); DBUG_PRINT("info", ("listing directory: %s", ds_dirname->str)); - /* Note that my_dir sorts the list if not given any flags */ - if (!(dir_info= my_dir(ds_dirname->str, MYF(0)))) + if (!(dir_info= my_dir(ds_dirname->str, MYF(MY_WANT_SORT)))) DBUG_RETURN(1); set_wild_chars(1); - for (i= 0; i < (uint) dir_info->number_off_files; i++) + for (i= 0; i < (uint) dir_info->number_of_files; i++) { file= dir_info->dir_entry + i; - if (file->name[0] == '.' && - (file->name[1] == '\0' || - (file->name[1] == '.' && file->name[2] == '\0'))) - continue; /* . or .. */ if (ds_wild && ds_wild->length && wild_compare(file->name, ds_wild->str, 0)) continue; |