Browse Source

[core] copy string and len directly from tmp_buf

copy string and len directly from tmp_buf without buffer_commit(tb, ...)
if tmp_buf contents are not used after the copy
master
Glenn Strauss 9 months ago
parent
commit
160baff923
  1. 6
      src/burl.c
  2. 6
      src/keyvalue.c

6
src/burl.c

@ -90,8 +90,7 @@ static int burl_normalize_basic_unreserved_fix (buffer *b, buffer *t, int i, int
if (li_utf8_invalid_byte(s[i])) qs = -2;
}
}
buffer_commit(t, (size_t)j);
buffer_copy_buffer(b, t);
buffer_copy_string_len(b, (char *)p, (size_t)j);
return qs;
}
@ -166,8 +165,7 @@ static int burl_normalize_basic_required_fix (buffer *b, buffer *t, int i, int q
if (li_utf8_invalid_byte(s[i])) qs = -2;
}
}
buffer_commit(t, (size_t)j);
buffer_copy_buffer(b, t);
buffer_copy_string_len(b, (char *)p, (size_t)j);
return qs;
}

6
src/keyvalue.c

@ -394,8 +394,7 @@ static void pcre_keyvalue_burl_percent_high_UTF8 (buffer *b, buffer *t)
p[++j] = hex_chars_uc[s[i] & 0xF];
}
}
buffer_commit(t, j);
buffer_copy_buffer(b, t);
buffer_copy_string_len(b, (char *)p, (size_t)j);
}
static void pcre_keyvalue_burl_percent_percent_high_UTF8 (buffer *b, buffer *t)
@ -420,8 +419,7 @@ static void pcre_keyvalue_burl_percent_percent_high_UTF8 (buffer *b, buffer *t)
p[++j] = hex_chars_uc[s[i] & 0xF];
}
}
buffer_commit(t, j);
buffer_copy_buffer(b, t);
buffer_copy_string_len(b, (char *)p, (size_t)j);
}
/* Basic normalization of regex and regex replacement to mirror some of

Loading…
Cancel
Save