aspell-devel
[Top][All Lists]
Advanced

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

Re: [aspell-devel] Partial improvement for compress


From: Jose Da Silva
Subject: Re: [aspell-devel] Partial improvement for compress
Date: Mon, 30 Aug 2004 18:08:14 -0700
User-agent: KMail/1.6.1

Hi,
Please accept some, or all, of the improvements to compress.c as per the new 
attached diff file.  (If you wish to collect changes, there is no hurry in 
posting this right away, since nothing shown here appears critical to fix).

I think it has a couple of improvements worth keeping, such as testing for 
output device error/full plus other misc improvements already mentioned per 
the message sent earlier under this same subject line.

If you think the "-v" option is worth keeping, it needs to be fixed for the 
appropriate version number.
(I noticed that prezip.c has if (strcmp(argv[1], "-V"))... do you want to 
keep it as capital -V or smallcase -v)

If some of the ideas lend well to other files such as prezip.c, please go 
ahead and use them there too.

Thanks.


On Sunday 29 August 2004 03:45 pm, Jose Da Silva wrote:
> Only a partial improvement, I think there is room for more improvements,
> so there is a question to ask too before I send a further update.
>
> Appears diff caught some more trailing spaces.... but main reason for
> sending this was....
>
> 1)modification to get_word():
> get_word() function and inconsistent EOF output.
> I was a bit puzzled about why there is an ungetc(c,in) because compress.c
> by itself does not seem to need an ungetc() to work correctly... the only
> reason I can seem to think it's there is in case some calling program
> wants to see an EOF
> Reason for change:
> the first if (c == EOF) return 0; does not reverse but the second if (c ==
> EOF return 0; does reverse input using an ungetc(c, in).
>
> My preference would be to remove the ungetc() completely from the routine,
> but if you have a reason for it staying, I think this modification to the
> get_word() function should return more consistent results if a parent
> program needs to see an EOF on the input file.
>
> question: can the ungetc() be removed, or does it have to stay?
>
> 2)a little less code by removing a query:
> -      while (prev[i] != '\0' && cur[i] != '\0' && prev[i] == cur[i])
> +      while (prev[i] != '\0' && prev[i] == cur[i])
> I removed the && (cur[i] != 0) since you can't have (cur[i] ==0) if you
> are going to have (prev[i] == cur[i]).
>
> 3)added fflush(stdout)
> the '\n' flushes out whatever is in the buffers, but since this is a
> binary file missing a final '\n', you will need to add a fflush() to send
> everything to stdout.






Attachment: compress_diff_2.txt
Description: Text document


reply via email to

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