[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspell-devel] Partial improvement for compress
From: |
Jose Da Silva |
Subject: |
[aspell-devel] Partial improvement for compress |
Date: |
Sun, 29 Aug 2004 15:45:49 -0700 |
User-agent: |
KMail/1.6.1 |
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.
compress_diff.txt
Description: Text document
- [aspell-devel] Partial improvement for compress,
Jose Da Silva <=