summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-11-27 14:17:19 -0800
committerChad Versace <chad.versace@linux.intel.com>2012-11-27 14:17:19 -0800
commitf919a0d337a1d2c586191cc5de2714cc631a5620 (patch)
treea3128ae8acceb18531b5845a8f1997802c1986fe /examples
parent4e404c1582ccdd8ae19bb2e9bb632a87b3335b49 (diff)
waffle: Declare loop iterators the C99 way
That is, declare all loop iterators like this: for (int i = 0; ...) rather than: int i; ... for (i = 0; ...) Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/gl_basic.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/gl_basic.c b/examples/gl_basic.c
index 0f6a913..c3abc2f 100644
--- a/examples/gl_basic.c
+++ b/examples/gl_basic.c
@@ -197,9 +197,7 @@ enum_map_translate_str(
const char *s,
int *result)
{
- const struct enum_map *i;
-
- for (i = self; i->i != 0; ++i) {
+ for (const struct enum_map *i = self; i->i != 0; ++i) {
if (!strncmp(s, i->s, strlen(i->s) + 1)) {
*result = i->i;
return true;
@@ -311,7 +309,6 @@ parse_args(int argc, char *argv[], struct options *opts)
static bool
draw(struct waffle_window *window)
{
- int i, j;
bool ok;
unsigned char *colors;
@@ -321,7 +318,7 @@ draw(struct waffle_window *window)
.tv_nsec = 500000000,
};
- for (i = 0; i < 3; ++i) {
+ for (int i = 0; i < 3; ++i) {
switch (i) {
case 0: glClearColor(1, 0, 0, 1); break;
case 1: glClearColor(0, 1, 0, 1); break;
@@ -336,7 +333,7 @@ draw(struct waffle_window *window)
WINDOW_WIDTH, WINDOW_HEIGHT,
GL_RGBA, GL_UNSIGNED_BYTE,
colors);
- for (j = 0; j < WINDOW_WIDTH * WINDOW_HEIGHT * 4; j += 4) {
+ for (int j = 0; j < WINDOW_WIDTH * WINDOW_HEIGHT * 4; j += 4) {
if ((colors[j] != (i == 0 ? 0xff : 0)) ||
(colors[j+1] != (i == 1 ? 0xff : 0)) ||
(colors[j+2] != (i == 2 ? 0xff : 0)) ||