mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 03:03:57 +08:00
Make sure rgb_color_t doesn't grow
For years the comment above the class claimed it was 4 bytes, but it had grown to 5. Add a static_assert() to prevent that from happening again.
This commit is contained in:
parent
ed0a7f5cdb
commit
8230755bfd
|
@ -13,7 +13,8 @@ struct color24_t {
|
|||
unsigned char rgb[3];
|
||||
};
|
||||
|
||||
/// A type that represents a color. We work hard to keep it at a size of 4 bytes.
|
||||
/// A type that represents a color. We work hard to keep it at a size of 4 bytes and verify with
|
||||
/// static_assert
|
||||
class rgb_color_t {
|
||||
// Types
|
||||
enum { type_none, type_named, type_rgb, type_normal, type_reset };
|
||||
|
@ -169,4 +170,6 @@ class rgb_color_t {
|
|||
static wcstring_list_t named_color_names(void);
|
||||
};
|
||||
|
||||
static_assert(sizeof(rgb_color_t) <= 4, "rgb_color_t is too big");
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user