[Freedos-kernel] patch: break.c

2004-05-30 Thread Arkady V.Belousov
Hi!

- removed extraneous variable assignment; code optimization.

---BeginMessage---
diff -ruNp old/kernel/break.c new/kernel/break.c
--- old/kernel/break.c  2004-04-14 08:40:36.0 +
+++ new/kernel/break.c  2004-04-24 11:55:44.0 +
@@ -53,13 +53,13 @@ unsigned char ctrl_break_pressed(void)
 
 unsigned char check_handle_break(struct dhdr FAR **pdev)
 {
-  unsigned char c = CTL_C;
-  if (!ctrl_break_pressed())
-c = (unsigned char)ndread(syscon);
-  if (c != CTL_C  *pdev != syscon)
-c = (unsigned char)ndread(pdev);
-  if (c == CTL_C)
+  unsigned char c;
+  if (ctrl_break_pressed() ||
+ (c = (unsigned char)ndread(syscon)) == CTL_C ||
+  *pdev != syscon  (c = (unsigned char)ndread(pdev))== CTL_C)
+  {
 handle_break(pdev, -1);
+  }
   return c;
 }
 
@@ -90,4 +90,3 @@ void handle_break(struct dhdr FAR **pdev
 
   spawn_int23();/* invoke user INT-23 and never come back */
 }
-
---End Message---


Re: [Freedos-kernel] patch: break.c

2004-05-09 Thread Arkady V.Belousov
Hi!

9--2004 16:58 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

BO Please, if you send a patch, state the purpose.
BO Why do you think this is necessary?

break.c: removed extraneous variable initialization.
dsk.c: optimization.
initdisk.c:
- fix: is_suspect().
- fix: nHardDisk now limited by MAX_HARD_DRIVE, not MAX_HARD_DRIVE-1.
- hardly optimized LBA_Get_Drive_Parameters() call (for example, memset()
  moved inside).
- ddt initialization moved into separate function make_ddt(), removed
  extraneous pddt pointer.
- other small optimizations.

BO If it saves on code size, how many bytes does it save for OpenWatcom?

break.c: 4 bytes.
total over all three files: TGROUP reduced from 0E222h to 0E1D1h; HMA_TEXT
reduced from 0A66Ah yo 0A65Eh, INIT_TEXT reduced from 3BB2h to 3B71h. (Note:
fix for is_suspect() increases code).




---
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel