Project

General

Profile

Feature #455 ยป 0046-shared.c-Replace-parameter-checking-fc_asserts-with-.patch

Marko Lindqvist, 04/28/2024 02:39 PM

View differences:

utility/shared.c
static struct astring realfile = ASTRING_INIT;
static void remove_trailing_char(char *s, char trailing)
fc__attribute((nonnull (1)));
static int compare_file_mtime_ptrs(const struct fileinfo *const *ppa,
const struct fileinfo *const *ppb);
......
****************************************************************************/
char *skip_leading_spaces(char *s)
{
fc_assert_ret_val(s != nullptr, nullptr);
while (*s != '\0' && fc_isspace(*s)) {
s++;
}
......
{
char *t;
fc_assert_ret(s != nullptr);
t = skip_leading_spaces(s);
if (t != s) {
while (*t != '\0') {
......
char *t;
size_t len;
fc_assert_ret(s != nullptr);
len = strlen(s);
if (len > 0) {
t = s + len -1;
......
{
char *t;
fc_assert_ret(s != nullptr);
t = s + strlen(s) -1;
while (t>=s && (*t) == trailing) {
*t = '\0';
......
{
const char *start;
fc_assert_ret_val(str != nullptr, FALSE);
while (fc_isspace(*str)) {
/* Skip leading spaces. */
str++;
......
{
const char *start;
fc_assert_ret_val(str != nullptr, FALSE);
while (fc_isspace(*str)) {
/* Skip leading spaces. */
str++;
......
bool dot;
const char *start;
fc_assert_ret_val(str != nullptr, FALSE);
while (fc_isspace(*str)) {
/* Skip leading spaces. */
str++;
utility/shared.h
int compare_strings_strvec(const char *const *first,
const char *const *second);
char *skip_leading_spaces(char *s);
void remove_leading_spaces(char *s);
void remove_trailing_spaces(char *s);
char *skip_leading_spaces(char *s)
fc__attribute((nonnull (1)));
void remove_leading_spaces(char *s)
fc__attribute((nonnull (1)));
void remove_trailing_spaces(char *s)
fc__attribute((nonnull (1)));
void remove_leading_trailing_spaces(char *s);
bool check_strlen(const char *str, size_t len, const char *errmsg);
......
char *end_of_strn(char *str, int *nleft);
bool str_to_int(const char *str, int *pint);
bool str_to_uint(const char *str, unsigned int *pint);
bool str_to_float(const char *str, float *pfloat);
bool str_to_int(const char *str, int *pint)
fc__attribute((nonnull (1)));
bool str_to_uint(const char *str, unsigned int *pint)
fc__attribute((nonnull (1)));
bool str_to_float(const char *str, float *pfloat)
fc__attribute((nonnull (1)));
/**************************************************************************
...
...
**************************************************************************/
struct fileinfo {
char *name; /* Descriptive file name string */
    (1-1/1)