~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_lib.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#endif
43
43
 
44
44
/*
45
 
  We are assuming that directory we are reading is either has less than 
 
45
  We are assuming that directory we are reading is either has less than
46
46
  100 files and so can be read in one initial chunk or has more than 1000
47
47
  files and so big increment are suitable.
48
48
*/
60
60
{
61
61
  if (buffer)
62
62
  {
63
 
    delete_dynamic((DYNAMIC_ARRAY*)((char*)buffer + 
 
63
    delete_dynamic((DYNAMIC_ARRAY*)((char*)buffer +
64
64
                                    ALIGN_SIZE(sizeof(MY_DIR))));
65
 
    free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) + 
 
65
    free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
66
66
                          ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
67
67
    free((unsigned char*) buffer);
68
68
  }
95
95
#endif
96
96
 
97
97
  dirp = opendir(directory_file_name(tmp_path,(char *) path));
98
 
  if (dirp == NULL || 
99
 
      ! (buffer= (char *) my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) + 
 
98
  if (dirp == NULL ||
 
99
      ! (buffer= (char *) my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) +
100
100
                                    ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
101
101
                                    sizeof(MEM_ROOT), MyFlags)))
102
102
    goto error;
103
103
 
104
 
  dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR))); 
 
104
  dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)));
105
105
  names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
106
106
                             ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)));
107
 
  
 
107
 
108
108
  if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
109
109
                            ENTRIES_START_SIZE, ENTRIES_INCREMENT))
110
110
  {
112
112
    goto error;
113
113
  }
114
114
  init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
115
 
  
 
115
 
116
116
  /* MY_DIR structure is allocated and completly initialized at this point */
117
117
  result= (MY_DIR*)buffer;
118
118
 
119
119
  tmp_file= strchr(tmp_path, '\0');
120
120
 
121
121
  dp= (struct dirent*) dirent_tmp;
122
 
  
 
122
 
123
123
  while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
124
124
  {
125
125
    if (!(finfo.name= strdup_root(names_storage, dp->d_name)))
126
126
      goto error;
127
 
    
 
127
 
128
128
    if (MyFlags & MY_WANT_STAT)
129
129
    {
130
 
      if (!(finfo.mystat= (struct stat*)alloc_root(names_storage, 
 
130
      if (!(finfo.mystat= (struct stat*)alloc_root(names_storage,
131
131
                                               sizeof(struct stat))))
132
132
        goto error;
133
 
      
 
133
 
134
134
      memset(finfo.mystat, 0, sizeof(struct stat));
135
135
      my_stpcpy(tmp_file,dp->d_name);
136
136
      stat(tmp_path, finfo.mystat);
150
150
#endif
151
151
  result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
152
152
  result->number_off_files= dir_entries_storage->elements;
153
 
  
 
153
 
154
154
  if (!(MyFlags & MY_DONT_SORT))
155
155
    my_qsort((void *) result->dir_entry, result->number_off_files,
156
156
          sizeof(FILEINFO), (qsort_cmp) comp_names);