This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: [PATCH] enlarge allowable size of diagnostic strings
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: jeroen dobbelaere <jeroen dot dobbelaere at acunia dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Thu, 17 Jan 2002 13:11:15 +0100
- Subject: Re: [ECOS] [PATCH] enlarge allowable size of diagnostic strings
- References: <3C46BC32.6040806@acunia.com>
Wouldn't it be better to put the if outside the loop? At the moment
its evaluated for every character. This will catch a string that is not
terminated within 256 characters. If you put it outside the loop there
is a small danger that a string does not have a termination before the
end of memory. In that case you will get an exception when you fall of
the edge of the world rather than a "Not a string" message. But you
get a speedup in the normal case.
Andrew
On Thu, Jan 17, 2002 at 12:57:38PM +0100, jeroen dobbelaere wrote:
> Following patch makes the reasonable length of what is 'known' to
> be a string more reasonable ;)
>
> diff -cNr ecos/packages/infra/current/src/diag.cxx ecos_unified_flash/packages/infra/current/src/diag.cxx
> *** ecos/packages/infra/current/src/diag.cxx Fri Dec 7 15:15:05 2001
> --- ecos_unified_flash/packages/infra/current/src/diag.cxx Thu Jan 17 12:36:48 2002
> ***************
> *** 227,233 ****
>
> /* Check for a reasonable length string. */
>
> ! if( s-str > 256 ) result = false;
>
> /* We only really support CR, NL, and backspace at present. If
> * we want to use tabs or other special chars, this test will
> --- 227,233 ----
>
> /* Check for a reasonable length string. */
>
> ! if( s-str > 2048 ) result = false;
>
> /* We only really support CR, NL, and backspace at present. If
> * we want to use tabs or other special chars, this test will
> diff -cNr ecos/packages/infra/current/ChangeLog ecos_unified_flash/packages/infra/current/ChangeLog
> *** ecos/packages/infra/current/ChangeLog Fri Dec 7 15:15:05 2001
> --- ecos_unified_flash/packages/infra/current/ChangeLog Thu Jan 17 12:49:07 2002
> ***************
> *** 1,3 ****
> --- 1,7 ----
> + 2002-01-17 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
> +
> + * src/diag.cxx (diag_check_string): enlarge valid string length to 2048
> +
> 2001-12-06 Jesper Skov <jskov@redhat.com>
>
> * src/diag.cxx: Added functions to do memory dump in 16 and 32 bit
>
>
> --
> Jeroen Dobbelaere
> Embedded Software Engineer
>
> ACUNIA Embedded Solutions
> http://www.acunia.com
>
>