~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_tempdir.c

Merged current state of use-replace-funcs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
22
22
{
23
 
  char *end, *copy;
 
23
  const char *end;
 
24
  char *copy;
24
25
  char buff[FN_REFLEN];
25
26
 
26
27
  pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
33
34
    if (!pathlist || !pathlist[0])
34
35
      pathlist=(char*) P_tmpdir;
35
36
  }
36
 
  do
37
 
  {
 
37
  do {
38
38
    uint length;
39
 
    end=strcend(pathlist, DELIM);
 
39
    end= strrchr(pathlist, DELIM);
 
40
    if (end == NULL)
 
41
      end= pathlist+strlen(pathlist);
40
42
    strmake(buff, pathlist, (uint) (end-pathlist));
41
43
    length= cleanup_dirname(buff, buff);
42
44
    if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
43
45
        insert_dynamic(&tmpdir->full_list, (uchar*) &copy))
44
46
      return(true);
45
47
    pathlist=end+1;
46
 
  }
47
 
  while (*end);
 
48
  } while (*end != '\0');
48
49
  freeze_size(&tmpdir->full_list);
49
50
  tmpdir->list=(char **)tmpdir->full_list.buffer;
50
51
  tmpdir->max=tmpdir->full_list.elements-1;