[hitori] core: Add preconditions to generator function



commit 9fbf9db1abde66f1513d740d9229765114e50211
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sun Jun 22 15:12:19 2014 +0100

    core: Add preconditions to generator function
    
    This helps static analysis.

 src/generator.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/generator.c b/src/generator.c
index 9cb4511..066a0e6 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -32,6 +32,10 @@ hitori_generate_board (Hitori *hitori, guint new_board_size, gint seed)
        HitoriVector iter;
        gboolean *accum, **horiz_accum;
 
+       g_return_if_fail (hitori != NULL);
+       g_return_if_fail (new_board_size > 0);
+       g_return_if_fail (seed >= -1);
+
        /* Seed the random number generator */
        if (seed == -1) {
                GTimeVal time_;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]