Салям!

11-Июн-2006 02:47 [EMAIL PROTECTED] (Blair Campbell) wrote to
[EMAIL PROTECTED]:

BC> +++ which.c 11 Jun 2006 02:47:05 -0000      1.3
BC>             fputs(arg[i], stdout);
----------------^^^^^---------^^^^^^
BC>             if((p = find_which(arg[i])) != 0) {
BC> -                   putchar('\t');
BC> +//                 putchar('\t');
BC> +            write( 1, "\t", 1 );
-----------------^^^^^--^

      Bug! FILE* and handle functions shouldn't be mixed (at least, without
intermediate FILE* buffers flushing)!

      Also, why not wrote own function for writing string? This should
minimize other RTL functions, especially if for this function will be
selected optimal calling convention, like `pascal':

#define OPTIMALCALL pascal
void OPTIMALCALL myout (FILE *out, const char s []) {
   fwrite (s, 1, strlen (s), out);
}
...
myout (stdout, arg [i]);
...
myout (stdout, "\t");

Or, if there is only "myout(stdout" is used, then:

#define OPTIMALCALL pascal
void OPTIMALCALL myout (const char s []) {
   fwrite (s, 1, strlen (s), stdout);
}
...
myout (arg [i]);
...
myout ("\t");

This should _noticeably_ decrease code size. Especially, if you all FILE*
functions (fwrite, printf, etc) replace by handle-oriented functions.


_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to