- /* Otherwise, duplicate the string whilst performing
- * the replacements using the position cache. */
- pret = ret;
- memcpy(pret, str, pos_cache[0]);
- pret += pos_cache[0];
- for (i = 0; i < count; i++) {
- memcpy(pret, to, tolen);
- pret += tolen;
- pstr = str + pos_cache[i] + fromlen;
- cpylen = (i == count-1 ? orglen : pos_cache[i+1]) - pos_cache[i] - fromlen;
- memcpy(pret, pstr, cpylen);
- pret += cpylen;
- }
- ret[retlen] = '\0';