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

Function my_load_path

mysys/mf_loadpath.c:26–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 /* else unpack path according to current dir */
25
26char * my_load_path(char * to, const char *path,
27 const char *own_path_prefix)
28{
29 char buff[FN_REFLEN];
30 int is_cur;
31 DBUG_ENTER("my_load_path");
32 DBUG_PRINT("enter",("path: %s prefix: %s",path,
33 own_path_prefix ? own_path_prefix : ""));
34
35 if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
36 test_if_hard_path(path))
37 (void) strnmov(buff, path, FN_REFLEN);
38 else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
39 (is_prefix(path,FN_PARENTDIR)) ||
40 ! own_path_prefix)
41 {
42 if (is_cur)
43 is_cur=2; /* Remove current dir */
44 if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
45 (void) strncat(buff, path+is_cur, FN_REFLEN-1);
46 else
47 (void) strnmov(buff, path, FN_REFLEN); /* Return org file name */
48 }
49 else
50 (void) strxnmov(buff, FN_REFLEN, own_path_prefix, path, NullS);
51 strnmov(to, buff, FN_REFLEN);
52 to[FN_REFLEN-1]= '\0';
53 DBUG_PRINT("exit",("to: %s",to));
54 DBUG_RETURN(to);
55} /* my_load_path */

Callers 3

fix_pathsFunction · 0.85
read_textsFunction · 0.85
my_realpathFunction · 0.85

Calls 5

test_if_hard_pathFunction · 0.85
strnmovFunction · 0.85
is_prefixFunction · 0.85
my_getwdFunction · 0.85
strxnmovFunction · 0.85

Tested by

no test coverage detected