From: Michael Stapelberg Date: Sun, 28 Feb 2010 17:39:11 +0000 (+0100) Subject: Move update_if_necessary to util.c, will be necessary later X-Git-Tag: 3.e~6^2~139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7caf98dd189a6cc2c238d8d8db731d1d5846bd63;p=i3%2Fi3 Move update_if_necessary to util.c, will be necessary later --- diff --git a/include/util.h b/include/util.h index e45fc75a..d1384962 100644 --- a/include/util.h +++ b/include/util.h @@ -41,6 +41,13 @@ extern struct keyvalue_table_head by_child; int min(int a, int b); int max(int a, int b); +/** + * Updates *destination with new_value and returns true if it was changed or false + * if it was the same + * + */ +bool update_if_necessary(uint32_t *destination, const uint32_t new_value); + /** * Safe-wrapper around malloc which exits if malloc returns NULL (meaning that * there is no more memory available) diff --git a/src/layout.c b/src/layout.c index 1017c3dd..182870df 100644 --- a/src/layout.c +++ b/src/layout.c @@ -31,17 +31,6 @@ #include "log.h" #include "container.h" -/* - * Updates *destination with new_value and returns true if it was changed or false - * if it was the same - * - */ -static bool update_if_necessary(uint32_t *destination, const uint32_t new_value) { - uint32_t old_value = *destination; - - return ((*destination = new_value) != old_value); -} - /* * Gets the unoccupied space (= space which is available for windows which were resized by the user) * for the given row. This is necessary to render both, customly resized windows and never touched diff --git a/src/util.c b/src/util.c index 1cdc758a..f14052b0 100644 --- a/src/util.c +++ b/src/util.c @@ -46,6 +46,17 @@ int max(int a, int b) { return (a > b ? a : b); } +/* + * Updates *destination with new_value and returns true if it was changed or false + * if it was the same + * + */ +bool update_if_necessary(uint32_t *destination, const uint32_t new_value) { + uint32_t old_value = *destination; + + return ((*destination = new_value) != old_value); +} + /* * The s* functions (safe) are wrappers around malloc, strdup, …, which exits if one of * the called functions returns NULL, meaning that there is no more memory available