OpenOCD
string_choices.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef OPENOCD_HELPER_STRING_CHOICES_H
4 #define OPENOCD_HELPER_STRING_CHOICES_H
5 
6 #include <helper/types.h>
7 
8 /*
9  * This file contains helper functions that return one of two strings depending
10  * on a boolean value. The format of these functions is 'str_$true_$false' where
11  * $true and $false are the two corresponding strings.
12  *
13  * These helper functions are beneficial because they improve code consistency
14  * and reduce the number of hardcoded strings.
15  */
16 
17 static inline const char *str_enabled_disabled(bool value)
18 {
19  return value ? "enabled" : "disabled";
20 }
21 
22 #endif /* OPENOCD_HELPER_STRING_CHOICES_H */
static const char * str_enabled_disabled(bool value)