Return a newly-allocated string that is like STR except replace its suffix SUFFIX with NEWSUFFIX. */
| 1525 | /* Return a newly-allocated string that is like STR |
| 1526 | except replace its suffix SUFFIX with NEWSUFFIX. */ |
| 1527 | static char * |
| 1528 | subst_suffix (char const *str, char const *suffix, char const *newsuffix) |
| 1529 | { |
| 1530 | idx_t prefixlen = suffix - str; |
| 1531 | idx_t newsuffixsize = strlen (newsuffix) + 1; |
| 1532 | char *r = ximalloc (prefixlen + newsuffixsize); |
| 1533 | memcpy (r + prefixlen, newsuffix, newsuffixsize); |
| 1534 | return memcpy (r, str, prefixlen); |
| 1535 | } |
| 1536 | |
| 1537 | /* Create a hard link to SRC_NAME aka SRC_DIRFD+SRC_RELNAME; |
| 1538 | the new link is at DST_NAME aka DST_DIRFD+DST_RELNAME. |
no outgoing calls
no test coverage detected