summaryrefslogtreecommitdiff
path: root/src/composite.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-04-07 11:43:17 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-04-07 11:44:04 -0700
commit404a5470cf1b1ae5bd464aaf8fe909b86faa2e61 (patch)
tree3808ac97bf29c76b275e0fdf55f0fde85468182b /src/composite.c
parent74732c541228ebb9f0a15b0a22132a85b32de89b (diff)
downloademacs-404a5470cf1b1ae5bd464aaf8fe909b86faa2e61.tar.gz
Simplify fill_gstring_header
* src/composite.c (fill_gstring_header): Omit first argument HEADER, since in practice it is always nil. Change caller to match. Help the compiler by telling it LEN is nonnegative. Problem found with --enable-gcc-warnings and gcc -O2 -Og.
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/composite.c b/src/composite.c
index c426cbb1246..88f1235f116 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -787,28 +787,19 @@ static Lisp_Object gstring_work;
static Lisp_Object gstring_work_headers;
static Lisp_Object
-fill_gstring_header (Lisp_Object header, ptrdiff_t from, ptrdiff_t from_byte,
+fill_gstring_header (ptrdiff_t from, ptrdiff_t from_byte,
ptrdiff_t to, Lisp_Object font_object, Lisp_Object string)
{
- ptrdiff_t len = to - from, i;
-
+ ptrdiff_t len = to - from;
if (len == 0)
error ("Attempt to shape zero-length text");
- if (VECTORP (header))
- {
- if (ASIZE (header) != len + 1)
- args_out_of_range (header, make_fixnum (len + 1));
- }
- else
- {
- if (len <= 8)
- header = AREF (gstring_work_headers, len - 1);
- else
- header = make_uninit_vector (len + 1);
- }
+ eassume (0 < len);
+ Lisp_Object header = (len <= 8
+ ? AREF (gstring_work_headers, len - 1)
+ : make_uninit_vector (len + 1));
ASET (header, 0, font_object);
- for (i = 0; i < len; i++)
+ for (ptrdiff_t i = 0; i < len; i++)
{
int c;
@@ -1748,7 +1739,7 @@ should be ignored. */)
frombyte = string_char_to_byte (string, frompos);
}
- header = fill_gstring_header (Qnil, frompos, frombyte,
+ header = fill_gstring_header (frompos, frombyte,
topos, font_object, string);
gstring = gstring_lookup_cache (header);
if (! NILP (gstring))