- {
- char *match = strstr (arg, str);
- if (match)
- {
- char *from = match + str_len;
- size_t to_len = match - arg;
- char *to = strndup (arg, to_len);
-
- while (to && from)
- {
- str_append (&to, &to_len, with, with_len);
- if (to)
- {
- match = strstr (from, str);
- if (match)
- {
- str_append (&to, &to_len, from, match - from);
- from = match + str_len;
- }
- else
- {
- str_append (&to, &to_len, from, strlen (from));
- from = 0;
- }
- }
- }
-
- if (to)
- {
- if (delayed_copy)
- /* We avoided copying SRC to DST until we found a match;
+ {
+ char *match = strstr (arg, str);
+ if (match)
+ {
+ char *from = match + str_len;
+ size_t to_len = match - arg;
+ char *to = strndup (arg, to_len);
+
+ while (to && from)
+ {
+ str_append (&to, &to_len, with, with_len);
+ if (to)
+ {
+ match = strstr (from, str);
+ if (match)
+ {
+ str_append (&to, &to_len, from, match - from);
+ from = match + str_len;
+ }
+ else
+ {
+ str_append (&to, &to_len, from, strlen (from));
+ from = 0;
+ }
+ }
+ }
+
+ if (to)
+ {
+ if (delayed_copy)
+ /* We avoided copying SRC to DST until we found a match;