Move update_if_necessary to util.c, will be necessary later
This commit is contained in:
parent
e209fd7d3a
commit
7caf98dd18
|
@ -41,6 +41,13 @@ extern struct keyvalue_table_head by_child;
|
||||||
int min(int a, int b);
|
int min(int a, int b);
|
||||||
int max(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
|
* Safe-wrapper around malloc which exits if malloc returns NULL (meaning that
|
||||||
* there is no more memory available)
|
* there is no more memory available)
|
||||||
|
|
11
src/layout.c
11
src/layout.c
|
@ -31,17 +31,6 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "container.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)
|
* 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
|
* for the given row. This is necessary to render both, customly resized windows and never touched
|
||||||
|
|
11
src/util.c
11
src/util.c
|
@ -46,6 +46,17 @@ int max(int a, int b) {
|
||||||
return (a > b ? a : 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 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
|
* the called functions returns NULL, meaning that there is no more memory available
|
||||||
|
|
Loading…
Reference in New Issue