Eli Zaretskii writes: > >> +#ifdef emacs >> +#define STR_BASE_PTR(obj) \ >> + (BUFFERP (obj)? XBUFFER (obj)->text->beg : \ >> + STRINGP (obj)? SDATA (obj) : \ >> + NULL) > [...] > the only test in the macro should be STRINGP. > Hmm, not sure I feel comfortable being that implicit. I kept this macro the same except for using (NILP (obj)? current_buffer->...) instead of BUFFERP and XBUFFER. > > Btw, note that regex.c already has macros PTR_TO_OFFSET and > POS_AS_IN_BUFFER which you can use. AFAICT these are not useful for this: they give offets relative to string1 (or string2), which would not help to compute the new value for string1 (or string2, etc...). Since I was looking at it, I've also added a comment about the trick of punning the boolean result into buffer or string base index. ------ Here is the new patch: