Olivier Galibert <galibert(a)pobox.com> writes:
On Mon, May 18, 1998 at 02:46:14AM +0200, Hrvoje Niksic wrote:
> * Never use char pointers for internal works.
>
> In most circumstances it is a mistake to use a `char *p' variable, and
> increment it with p++, only to get Emchars from *p. The correct way
> is to declare p as `Bufbyte *p', use INC_CHARPTR (p) to increment it,
> and DEC_CHARPTR (p) to decrement it. Use set_charptr_emchar to set an
> Emchar at that position.
Danger Robinson :-) One has to remember that set_charptr_emchar
write 1-4 bytes depending on the Emchar, while the size of the
overwritten Emchar can be different. The net result is that you
can't use this macro to change a character in the middle of a
string. You can only append.
Exactly.
Also note that set_string_char is safe (if not optimal), because it
knows how to resize a string correctly.
--
Hrvoje Niksic <hniksic(a)srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Ask not for whom the <CONTROL-G> tolls.