projects
/
platform
/
upstream
/
libHarfBuzzSharp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
553bc3d
)
Pre-allocate buffers when adding string
author
Behdad Esfahbod
<behdad@behdad.org>
Mon, 15 Aug 2011 14:21:22 +0000
(16:21 +0200)
committer
Behdad Esfahbod
<behdad@behdad.org>
Mon, 15 Aug 2011 14:21:22 +0000
(16:21 +0200)
We do a conservative estimate of the number of characters, but still,
this limits the number of buffer reallocs to a small constant.
src/hb-buffer.cc
patch
|
blob
|
history
diff --git
a/src/hb-buffer.cc
b/src/hb-buffer.cc
index
3be3f44
..
3f46d68
100644
(file)
--- a/
src/hb-buffer.cc
+++ b/
src/hb-buffer.cc
@@
-723,6
+723,7
@@
hb_buffer_guess_properties (hb_buffer_t *buffer)
} \
if (item_length == -1) \
item_length = text_length - item_offset; \
+ buffer->ensure (buffer->len + item_length * sizeof (T) / 4); \
const T *next = (const T *) text + item_offset; \
const T *end = next + item_length; \
while (next < end) { \