rpi4b-temp-humidity/util.h

34 lines
967 B
C
Raw Normal View History

2024-02-23 22:56:10 -08:00
/*
* util.h - Utility functions
* Copyright (C) 2024 Alexander Rosenberg
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See the LICENSE file for more information.
*/
#ifndef INCLUDED_UTIL_H
#define INCLUDED_UTIL_H
#include <stdlib.h>
struct GlobalFlags {
const char *config_path; // path to config file
const char *gpio_path; // path of GPIO device file to use
};
extern struct GlobalFlags GLOBAL_FLAGS;
/*
* Like malloc(3), except that if allocation fails, an error will be written to
* standard error and abort(3) called
*/
void *malloc_checked(size_t n);
/*
* Like realloc(3), except that if allocation fails, an error will be written to
* standard error and abort(3) called
*/
void *realloc_checked(void *old_ptr, size_t n);
#endif