MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / dirname_length

Function dirname_length

mysys/mf_dirname.c:21–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 /* Functions definied in this file */
20
21size_t dirname_length(const char *name)
22{
23 register char *pos, *gpos;
24#ifdef BASKSLASH_MBTAIL
25 CHARSET_INFO *fs= fs_character_set();
26#endif
27#ifdef FN_DEVCHAR
28 if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0)
29#endif
30 pos=(char*) name-1;
31
32 gpos= pos++;
33 for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */
34 {
35#ifdef BASKSLASH_MBTAIL
36 uint l;
37 if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3)))
38 {
39 pos+= l - 1;
40 continue;
41 }
42#endif
43 if (*pos == FN_LIBCHAR || *pos == '/')
44 gpos=pos;
45 }
46 return (size_t) (gpos+1-(char*) name);
47}
48
49
50/*

Callers 5

is_secure_file_pathFunction · 0.85
dirname_partFunction · 0.85
check_if_legal_filenameFunction · 0.85
my_search_option_filesFunction · 0.85
my_print_default_filesFunction · 0.85

Calls 1

fs_character_setFunction · 0.85

Tested by

no test coverage detected