* @brief Normalize a path by combining base path and link path * * This function creates a temporary path by combining the base path and link path, * then normalizes it using dfs_normalize_path(). It handles memory allocation and * cleanup internally. * * @param[in] path The base path to combine with the link * @param[in] path_len Length of the base path * @param[in] link_fn The link path
| 158 | * @note The caller is responsible for freeing the returned path |
| 159 | */ |
| 160 | static char *_dfs_normalize_path(const char *path, int path_len, const char *link_fn, int link_len) |
| 161 | { |
| 162 | char *tmp_path, *fp; |
| 163 | |
| 164 | tmp_path = (char *)rt_malloc(path_len + link_len + 2); |
| 165 | if (!tmp_path) |
| 166 | { |
| 167 | return RT_NULL; |
| 168 | } |
| 169 | |
| 170 | memcpy(tmp_path, path, path_len); |
| 171 | tmp_path[path_len] = '/'; |
| 172 | memcpy(tmp_path + path_len + 1, link_fn, link_len); |
| 173 | tmp_path[path_len + 1 + link_len] = '\0'; |
| 174 | |
| 175 | fp = dfs_normalize_path(NULL, tmp_path); |
| 176 | rt_free(tmp_path); |
| 177 | |
| 178 | return fp; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * @brief Insert a link path into temporary path buffer |
no test coverage detected