[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about gawk unofficial patch

From: 木村浩一
Subject: Re: Question about gawk unofficial patch
Date: Wed, 09 Feb 2005 17:31:11 +0900


On Wed, 9 Feb 2005 09:27:18 +0200
Aharon Robbins <address@hidden> wrote:

> > malloced memory sizeof(wchar_t) * (r->wstlen + 2) bytes,
> > but just only copied r->wstlen bytes. I guess this is not enough.
> We need r->wstlen + 1 elements, note the assigment of a L'\0'
> after the memcpy.  The + 2 provides a little extra breathing room;
> it's been a convention in gawk for ages, before I took over full
> time maintanance even.  I've decided to continue using this convention
> even though in theory it's enough to just use length + 1 everywhere.

In my understanding, wstlen holds number of elements not bytes.
and memcpy copy data by byte counts. So, That memcpy have to copy
sizeof(wchar_t) * r->wstlen *bytes*, I guess.

Kimura Koichi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]