Project

General

Profile

Feature #2000 ยป 0031-rgbcolor.-ch-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 04/21/2026 04:23 AM

View differences:

common/rgbcolor.c
prgbcolor->r = r;
prgbcolor->g = g;
prgbcolor->b = b;
prgbcolor->color = NULL;
prgbcolor->color = nullptr;
return prgbcolor;
}
......
****************************************************************************/
struct rgbcolor *rgbcolor_copy(const struct rgbcolor *prgbcolor)
{
fc_assert_ret_val(prgbcolor != NULL, NULL);
fc_assert_ret_val(prgbcolor != nullptr, nullptr);
return rgbcolor_new(prgbcolor->r, prgbcolor->g, prgbcolor->b);
}
......
****************************************************************************/
bool rgbcolors_are_equal(const struct rgbcolor *c1, const struct rgbcolor *c2)
{
fc_assert_ret_val(c1 != NULL && c2 != NULL, FALSE);
fc_assert_ret_val(c1 != nullptr && c2 != nullptr, FALSE);
/* No check of cached 'color' member -- if values are equal, it should be
* equivalent */
......
char colorpath[256];
va_list args;
fc_assert_ret_val(file != NULL, FALSE);
fc_assert_ret_val(*prgbcolor == NULL, FALSE);
fc_assert_ret_val(file != nullptr, FALSE);
fc_assert_ret_val(*prgbcolor == nullptr, FALSE);
va_start(args, path);
fc_vsnprintf(colorpath, sizeof(colorpath), path, args);
......
char colorpath[256];
va_list args;
fc_assert_ret(file != NULL);
fc_assert_ret(prgbcolor != NULL);
fc_assert_ret(file != nullptr);
fc_assert_ret(prgbcolor != nullptr);
va_start(args, path);
fc_vsnprintf(colorpath, sizeof(colorpath), path, args);
......
bool rgbcolor_to_hex(const struct rgbcolor *prgbcolor, char *hex,
size_t hex_len)
{
fc_assert_ret_val(prgbcolor != NULL, FALSE);
fc_assert_ret_val(prgbcolor != nullptr, FALSE);
/* Needs a length greater than 7 ('#' + 6 hex digites and '\0'). */
fc_assert_ret_val(hex_len > 7, FALSE);
......
int rgb, r, g, b;
char hex2[16];
fc_assert_ret_val(*prgbcolor == NULL, FALSE);
fc_assert_ret_val(hex != NULL, FALSE);
fc_assert_ret_val(*prgbcolor == nullptr, FALSE);
fc_assert_ret_val(hex != nullptr, FALSE);
if (hex[0] == '#') {
hex++;
common/rgbcolor.h
* rulesets. */
struct color;
/* An RGBcolor contains the R,G,B bitvalues for a color. The color itself
* holds the color structure for this color but may be NULL (it's allocated
/* An RGBcolor contains the R,G,B bitvalues for a color. The color itself
* holds the color structure for this color but may be nullptr (it's allocated
* on demand at runtime). */
struct rgbcolor {
int r, g, b;
......
}
#endif /* __cplusplus */
#endif /* FC__RGBCOLOR_H */
#endif /* FC__RGBCOLOR_H */
    (1-1/1)