Demos (master): geartrain: improve loading routines
Brian Paul
brianp at kemper.freedesktop.org
Mon Aug 9 14:30:28 UTC 2010
Module: Demos
Branch: master
Commit: 64773600e2111ccdb3ee56a0ec6036812a605b1a
URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=64773600e2111ccdb3ee56a0ec6036812a605b1a
Author: Christian Authmann <christian at authmann.de>
Date: Mon Aug 9 08:27:47 2010 -0600
geartrain: improve loading routines
Signed-off-by: Brian Paul <brianp at vmware.com>
---
src/demos/geartrain.c | 29 +++++++++--------------------
1 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/src/demos/geartrain.c b/src/demos/geartrain.c
index 49a9a70..5d5e5e2 100644
--- a/src/demos/geartrain.c
+++ b/src/demos/geartrain.c
@@ -105,25 +105,14 @@ static GLint T0 = 0;
static GLint Frames = 0;
-#ifndef _WIN32
-static void
-strset (char buf[], char ch)
-{
- int i;
- for (i = 0; i < strlen (buf); i++)
- buf[i] = ch;
-}
-#endif
-
-
static void
Clear_Buffers (void)
{
- strset (Buf1, 0);
- strset (Buf2, 0);
- strset (Buf3, 0);
- strset (Buf4, 0);
- strset (Buf5, 0);
+ memset (Buf1, '\0', 256);
+ memset (Buf2, '\0', 256);
+ memset (Buf3, '\0', 256);
+ memset (Buf4, '\0', 256);
+ memset (Buf5, '\0', 256);
}
@@ -274,9 +263,12 @@ getdata (char filename[])
if (!(strcmp (Buf1, "GEAR2NAME")))
LoadText (b[belt_count - 1].gear2_name);
}
-
while (Buf1[0] != 0);
+ number_of_gears = gear_count;
+ number_of_axles = axle_count;
+ number_of_belts = belt_count;
+
for (i = 0; i < number_of_gears; i++)
{
g[i].axis = -1;
@@ -284,9 +276,6 @@ getdata (char filename[])
g[i].angular_velocity = 0.0;
}
- number_of_gears = gear_count;
- number_of_axles = axle_count;
- number_of_belts = belt_count;
fclose (mainfile);
}
More information about the mesa-commit
mailing list