From: anton Date: Sun, 1 Sep 2024 06:05:11 +0000 (+0000) Subject: Enable warnings and fix style nits. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f178d1a9db07ece186279bbac4b47f0bc743ae47;p=openbsd Enable warnings and fix style nits. --- diff --git a/regress/sys/sys/tree/rb-linux/Makefile b/regress/sys/sys/tree/rb-linux/Makefile index 8b43e9eb716..d7231d872fa 100644 --- a/regress/sys/sys/tree/rb-linux/Makefile +++ b/regress/sys/sys/tree/rb-linux/Makefile @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile,v 1.1 2024/09/01 00:22:59 aisha Exp $ +# $OpenBSD: Makefile,v 1.2 2024/09/01 06:05:11 anton Exp $ CFLAGS= -I${BSDSRCDIR}/sys/dev/pci/drm/include PROGS= rb-linux +WARNINGS=yes .include diff --git a/regress/sys/sys/tree/rb-linux/rb-linux.c b/regress/sys/sys/tree/rb-linux/rb-linux.c index c2cd9ef1100..ce07f1ca850 100644 --- a/regress/sys/sys/tree/rb-linux/rb-linux.c +++ b/regress/sys/sys/tree/rb-linux/rb-linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rb-linux.c,v 1.1 2024/09/01 00:22:59 aisha Exp $ */ +/* $OpenBSD: rb-linux.c,v 1.2 2024/09/01 06:05:11 anton Exp $ */ /* * Copyright 2002 Niels Provos * All rights reserved. @@ -42,7 +42,7 @@ struct keynode { struct rb_root root; -struct keynode * +static struct keynode * rb_find(struct rb_root *head, struct keynode *elm) { struct rb_node *tmp = head->rb_node; @@ -59,7 +59,7 @@ rb_find(struct rb_root *head, struct keynode *elm) return NULL; } -struct keynode * +static struct keynode * rb_insert(struct rb_root *head, struct keynode *elm) { struct rb_node **tmp; @@ -100,9 +100,10 @@ main(int argc, char **argv) for (t = 0; t < 10; t++) { for (i = 0; i < ITER; i++) { tmp = malloc(sizeof(struct keynode)); - if (tmp == NULL) err(1, "malloc"); + if (tmp == NULL) + err(1, "malloc"); do { - tmp->key = arc4random_uniform(MAX-MIN); + tmp->key = arc4random_uniform(MAX - MIN); tmp->key += MIN; } while (rb_find(&root, tmp) != NULL); if (i == 0)