diff options
Diffstat (limited to '')
-rw-r--r-- | src/fake-quartz-cg.c | 52 | ||||
-rw-r--r-- | src/fake-quartz-cg.h | 8 | ||||
-rw-r--r-- | src/fake-w32-gdi.c | 28 | ||||
-rw-r--r-- | src/fake-w32-gdi.h | 10 | ||||
-rw-r--r-- | src/gamma-helper.c | 4 | ||||
-rw-r--r-- | src/gamma-linux-drm.c | 14 | ||||
-rw-r--r-- | src/gamma-quartz-cg.c | 4 | ||||
-rw-r--r-- | src/gamma-x-randr.c | 40 | ||||
-rw-r--r-- | src/gamma-x-vidmode.c | 6 | ||||
-rw-r--r-- | src/libgamma-facade.c | 12 | ||||
-rw-r--r-- | src/libgamma-facade.h | 2 |
11 files changed, 94 insertions, 86 deletions
diff --git a/src/fake-quartz-cg.c b/src/fake-quartz-cg.c index b07558b..c5c18d8 100644 --- a/src/fake-quartz-cg.c +++ b/src/fake-quartz-cg.c @@ -35,8 +35,8 @@ #ifndef HAVE_GAMMA_METHOD_X_RANDR -CGError -CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID* displays_out, uint32_t* count_out) +CGError CGGetOnlineDisplayList(uint32_t max_size, + CGDirectDisplayID* restrict displays_out, uint32_t* restrict count_out) { uint32_t i; for (i = 0; (i < max_size) && (i < 2); i++) @@ -46,9 +46,9 @@ CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID* displays_out, uint3 return kCGErrorSuccess; } -CGError -CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, const CGGammaValue* red, - const CGGammaValue* green, const CGGammaValue* blue) + +CGError CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, const CGGammaValue* red, + const CGGammaValue* green, const CGGammaValue* blue) { (void) display; (void) red; @@ -64,9 +64,10 @@ CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, cons return kCGErrorSuccess; } -CGError -CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, CGGammaValue* red, - CGGammaValue* green, CGGammaValue* blue, uint32_t* gamma_size_out) + +CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, + CGGammaValue* restrict red, CGGammaValue* restrict green, + CGGammaValue* restrict blue, uint32_t* restrict gamma_size_out) { long i; (void) display; @@ -85,21 +86,18 @@ CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, CGGa return kCGErrorSuccess; } -void -CGDisplayRestoreColorSyncSettings(void) +void CGDisplayRestoreColorSyncSettings(void) { /* Do nothing. */ } -uint32_t -CGDisplayGammaTableCapacity(CGDirectDisplayID display) +uint32_t CGDisplayGammaTableCapacity(CGDirectDisplayID display) { (void) display; return 256; } -void -close_fake_quartz(void) +void close_fake_quartz(void) { /* Do nothing. */ } @@ -112,18 +110,19 @@ close_fake_quartz(void) -static xcb_connection_t* connection = NULL; -static xcb_randr_get_screen_resources_current_reply_t* res_reply = NULL; +static xcb_connection_t* restrict connection = NULL; +static xcb_randr_get_screen_resources_current_reply_t* restrict res_reply = NULL; static uint32_t crtc_count = 0; -static xcb_randr_crtc_t* crtcs = NULL; -static uint16_t* original_ramps = NULL; +static xcb_randr_crtc_t* restrict crtcs = NULL; +static uint16_t* restrict original_ramps = NULL; # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Waggregate-return" -CGError CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID* displays_out, uint32_t* count_out) +CGError CGGetOnlineDisplayList(uint32_t max_size, + CGDirectDisplayID* restrict displays_out, uint32_t* restrict count_out) { uint32_t i; @@ -133,7 +132,7 @@ CGError CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID* displays_ou xcb_screen_iterator_t iter; xcb_randr_get_screen_resources_current_cookie_t res_cookie; xcb_randr_get_crtc_gamma_cookie_t gamma_cookie; - xcb_randr_get_crtc_gamma_reply_t* gamma_reply; + xcb_randr_get_crtc_gamma_reply_t* restrict gamma_reply; connection = xcb_connect(NULL, NULL); @@ -228,15 +227,16 @@ CGError CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_si } -CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, CGGammaValue* red, - CGGammaValue* green, CGGammaValue* blue, uint32_t* gamma_size_out) +CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, + CGGammaValue* restrict red, CGGammaValue* restrict green, + CGGammaValue* restrict blue, uint32_t* restrict gamma_size_out) { xcb_randr_get_crtc_gamma_cookie_t gamma_cookie; - xcb_randr_get_crtc_gamma_reply_t* gamma_reply; + xcb_randr_get_crtc_gamma_reply_t* restrict gamma_reply; xcb_generic_error_t* error; - uint16_t* r_int; - uint16_t* g_int; - uint16_t* b_int; + uint16_t* restrict r_int; + uint16_t* restrict g_int; + uint16_t* restrict b_int; long i; if (gamma_size != 256) diff --git a/src/fake-quartz-cg.h b/src/fake-quartz-cg.h index f1d8e14..268347c 100644 --- a/src/fake-quartz-cg.h +++ b/src/fake-quartz-cg.h @@ -45,13 +45,15 @@ typedef float CGGammaValue; typedef uint32_t CGDirectDisplayID; -CGError CGGetOnlineDisplayList(uint32_t max_size, CGDirectDisplayID* displays_out, uint32_t* count_out); +CGError CGGetOnlineDisplayList(uint32_t max_size, + CGDirectDisplayID* restrict displays_out, uint32_t* restrict count_out); CGError CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, const CGGammaValue* red, const CGGammaValue* green, const CGGammaValue* blue); -CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, CGGammaValue* red, - CGGammaValue* green, CGGammaValue* blue, uint32_t* gamma_size_out); +CGError CGGetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, + CGGammaValue* restrict red, CGGammaValue* restrict green, + CGGammaValue* restrict blue, uint32_t* restrict gamma_size_out); void CGDisplayRestoreColorSyncSettings(void); diff --git a/src/fake-w32-gdi.c b/src/fake-w32-gdi.c index 66fa91f..65e191d 100644 --- a/src/fake-w32-gdi.c +++ b/src/fake-w32-gdi.c @@ -59,7 +59,7 @@ int GetDeviceCaps(HDC hDC, int nIndex) } /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx */ -BOOL SetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) +BOOL SetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) { (void) hDC; (void) lpRamp; @@ -67,7 +67,7 @@ BOOL SetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) } /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd316946(v=vs.85).aspx */ -BOOL GetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) +BOOL GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) { (void) hDC; (void) lpRamp; @@ -76,7 +76,8 @@ BOOL GetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx */ -HDC CreateDC(LPCTSTR lpszDriver, LPCTSTR lpszDevice, void* lpszOutput, void* lpInitData) +HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, + void* restrict lpszOutput, void* restrict lpInitData) { (void) lpszOutput; (void) lpInitData; @@ -88,7 +89,8 @@ HDC CreateDC(LPCTSTR lpszDriver, LPCTSTR lpszDevice, void* lpszOutput, void* lpI /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx */ -BOOL EnumDisplayDevices(LPCTSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDisplayDevice, DWORD dwFlags) +BOOL EnumDisplayDevices(LPCTSTR lpDevice, restrict DWORD iDevNum, + PDISPLAY_DEVICE restrict lpDisplayDevice, DWORD dwFlags) { (void) dwFlags; if (lpDevice != NULL) @@ -121,11 +123,11 @@ BOOL EnumDisplayDevices(LPCTSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDispl #define GAMMA_RAMP_SIZE 256 -static xcb_connection_t* connection = NULL; +static xcb_connection_t* restrict connection = NULL; static size_t dc_count = 0; static ssize_t crtc_count = -1; -static xcb_randr_crtc_t* crtcs = NULL; -static xcb_randr_get_screen_resources_current_reply_t* res_reply = NULL; +static xcb_randr_crtc_t* restrict crtcs = NULL; +static xcb_randr_get_screen_resources_current_reply_t* restrict res_reply = NULL; /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd144871(v=vs.85).aspx */ @@ -166,7 +168,7 @@ int GetDeviceCaps(HDC hDC, int nIndex) # pragma GCC diagnostic ignored "-Waggregate-return" /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx */ -BOOL SetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) +BOOL SetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) { xcb_void_cookie_t gamma_cookie = xcb_randr_set_crtc_gamma_checked(connection, *(xcb_randr_crtc_t*)hDC, GAMMA_RAMP_SIZE, @@ -179,10 +181,10 @@ BOOL SetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd316946(v=vs.85).aspx */ -BOOL GetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) +BOOL GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp) { xcb_randr_get_crtc_gamma_cookie_t gamma_cookie; - xcb_randr_get_crtc_gamma_reply_t* gamma_reply; + xcb_randr_get_crtc_gamma_reply_t* restrict gamma_reply; xcb_generic_error_t* error; gamma_cookie = xcb_randr_get_crtc_gamma(connection, *(xcb_randr_crtc_t*)hDC); @@ -207,7 +209,8 @@ BOOL GetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx */ -HDC CreateDC(LPCTSTR lpszDriver, LPCTSTR lpszDevice, void *lpszOutput, void *lpInitData) +HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, + void* restrict lpszOutput, void* restrict lpInitData) { int crtc_index = atoi(lpszDevice); @@ -257,7 +260,8 @@ HDC CreateDC(LPCTSTR lpszDriver, LPCTSTR lpszDevice, void *lpszOutput, void *lpI /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx */ -BOOL EnumDisplayDevices(LPCTSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDisplayDevice, DWORD dwFlags) +BOOL EnumDisplayDevices(LPCTSTR restrict lpDevice, DWORD iDevNum, + PDISPLAY_DEVICE restrict lpDisplayDevice, DWORD dwFlags) { size_t count = (size_t)crtc_count; (void) dwFlags; diff --git a/src/fake-w32-gdi.h b/src/fake-w32-gdi.h index 85fcfc9..3d3b412 100644 --- a/src/fake-w32-gdi.h +++ b/src/fake-w32-gdi.h @@ -52,14 +52,15 @@ int GetDeviceCaps(HDC hDC, int nIndex) __attribute__((const)); #define CM_GAMMA_RAMP 1 /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx */ -BOOL SetDeviceGammaRamp(HDC hDC, LPVOID lpRamp); +BOOL SetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp); /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd316946(v=vs.85).aspx */ -BOOL GetDeviceGammaRamp(HDC hDC, LPVOID lpRamp); +BOOL GetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp); /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx */ -HDC CreateDC(LPCTSTR lpszDriver, LPCTSTR lpszDevice, void* lpszOutput, void* lpInitData); +HDC CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, + void* restrict lpszOutput, void* restrict lpInitData); #define TEXT(X) ((LPCTSTR)(X)) /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd183569(v=vs.85).aspx */ @@ -73,7 +74,8 @@ typedef DISPLAY_DEVICE* PDISPLAY_DEVICE; #define DISPLAY_DEVICE_ACTIVE 1 /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd162609(v=vs.85).aspx */ -BOOL EnumDisplayDevices(LPCTSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDisplayDevice, DWORD dwFlags); +BOOL EnumDisplayDevices(LPCTSTR restrict lpDevice, DWORD iDevNum, + PDISPLAY_DEVICE restrict lpDisplayDevice, DWORD dwFlags); #endif diff --git a/src/gamma-helper.c b/src/gamma-helper.c index 9ae7915..5d73b02 100644 --- a/src/gamma-helper.c +++ b/src/gamma-helper.c @@ -185,7 +185,7 @@ int libgamma_translated_ramp_get_(libgamma_crtc_state_t* restrict this, size_t n; int r; libgamma_gamma_ramps_any_t ramps_sys; - uint64_t* ramps_full; + uint64_t* restrict ramps_full; if ((r = allocated_any_ramp(&ramps_sys, *ramps, depth_system, &n))) return r; @@ -234,7 +234,7 @@ int libgamma_translated_ramp_set_(libgamma_crtc_state_t* restrict this, size_t n; int r; libgamma_gamma_ramps_any_t ramps_sys; - uint64_t* ramps_full; + uint64_t* restrict ramps_full; if ((r = allocated_any_ramp(&ramps_sys, ramps, depth_system, &n))) return r; diff --git a/src/gamma-linux-drm.c b/src/gamma-linux-drm.c index bdb231c..ec9c1fc 100644 --- a/src/gamma-linux-drm.c +++ b/src/gamma-linux-drm.c @@ -193,7 +193,7 @@ int libgamma_linux_drm_partition_initialise(libgamma_partition_state_t* restrict libgamma_site_state_t* restrict site, size_t partition) { int rc = 0; - libgamma_drm_card_data_t* data; + libgamma_drm_card_data_t* restrict data; char pathname[PATH_MAX]; (void) site; @@ -413,7 +413,7 @@ int libgamma_linux_drm_crtc_restore(libgamma_crtc_state_t* restrict this) * @param error Output of the error value to store of error report fields for data that requires the connector '* @return The CRTC's conncetor, `NULL` on error */ -static drmModeConnector* find_connector(libgamma_crtc_state_t* restrict this, int* error) +static drmModeConnector* find_connector(libgamma_crtc_state_t* restrict this, int* restrict error) { uint32_t crtc_id = (uint32_t)(size_t)(this->data); libgamma_drm_card_data_t* restrict card = this->partition->data; @@ -483,9 +483,9 @@ static int get_gamma_ramp_size(libgamma_crtc_information_t* restrict out, const * @return Non-zero if at least on error occured */ static int read_connector_data(libgamma_crtc_state_t* restrict crtc, libgamma_crtc_information_t* restrict out, - const drmModeConnector* connector, int32_t fields) + const drmModeConnector* restrict connector, int32_t fields) { - const char* connector_name_base = NULL; + const char* restrict connector_name_base = NULL; /* Get some information that does not require too much work. */ if ((fields & (CRTC_INFO_WIDTH_MM | CRTC_INFO_HEIGHT_MM | CRTC_INFO_CONNECTOR_TYPE | @@ -596,8 +596,8 @@ static int get_edid(libgamma_crtc_state_t* restrict crtc, libgamma_drm_card_data_t* restrict card = crtc->partition->data; int prop_n = connector->count_props; int prop_i; - drmModePropertyRes* prop; - drmModePropertyBlobRes* blob; + drmModePropertyRes* restrict prop; + drmModePropertyBlobRes* restrict blob; for (prop_i = 0; prop_i < prop_n; prop_i++) { @@ -644,7 +644,7 @@ int libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t* restric { #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) int e = 0; - drmModeConnector* connector; + drmModeConnector* restrict connector; int require_connector; int free_edid; int error; diff --git a/src/gamma-quartz-cg.c b/src/gamma-quartz-cg.c index 9bbe0a1..1c25760 100644 --- a/src/gamma-quartz-cg.c +++ b/src/gamma-quartz-cg.c @@ -308,7 +308,7 @@ int libgamma_quartz_cg_get_crtc_information(libgamma_crtc_information_t* restric int libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsf_t* restrict ramps) { - CGDirectDisplayID* crtcs = this->partition->data; + CGDirectDisplayID* restrict crtcs = this->partition->data; CGDirectDisplayID crtc_id = crtcs[this->crtc]; uint32_t gamma_size_out; CGError r; @@ -338,7 +338,7 @@ int libgamma_quartz_cg_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict thi int libgamma_quartz_cg_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this, libgamma_gamma_rampsf_t ramps) { - CGDirectDisplayID* crtcs = this->partition->data; + CGDirectDisplayID* restrict crtcs = this->partition->data; CGDirectDisplayID crtc_id = crtcs[this->crtc]; CGError r; #ifdef DEBUG diff --git a/src/gamma-x-randr.c b/src/gamma-x-randr.c index 2749636..69aa095 100644 --- a/src/gamma-x-randr.c +++ b/src/gamma-x-randr.c @@ -180,10 +180,10 @@ int libgamma_x_randr_site_initialise(libgamma_site_state_t* restrict this, char* restrict site) { xcb_generic_error_t* error = NULL; - xcb_connection_t* connection; + xcb_connection_t* restrict connection; xcb_randr_query_version_cookie_t cookie; - xcb_randr_query_version_reply_t* reply; - const xcb_setup_t* setup; + xcb_randr_query_version_reply_t* restrict reply; + const xcb_setup_t* restrict setup; xcb_screen_iterator_t iter; this->data = connection = xcb_connect(site, NULL); @@ -285,15 +285,15 @@ int libgamma_x_randr_partition_initialise(libgamma_partition_state_t* restrict t { int fail_rc = LIBGAMMA_ERRNO_SET; xcb_connection_t* restrict connection = site->data; - const xcb_setup_t* setup = xcb_get_setup(connection); - xcb_screen_t* screen = NULL; + const xcb_setup_t* restrict setup = xcb_get_setup(connection); + xcb_screen_t* restrict screen = NULL; xcb_generic_error_t* error = NULL; xcb_screen_iterator_t iter; xcb_randr_get_screen_resources_current_cookie_t cookie; - xcb_randr_get_screen_resources_current_reply_t* reply; - xcb_randr_crtc_t* crtcs; - xcb_randr_output_t* outputs; - libgamma_x_randr_partition_data_t* data; + xcb_randr_get_screen_resources_current_reply_t* restrict reply; + xcb_randr_crtc_t* restrict crtcs; + xcb_randr_output_t* restrict outputs; + libgamma_x_randr_partition_data_t* restrict data; size_t i; if (setup == NULL) @@ -478,7 +478,7 @@ static int get_gamma_ramp_size(libgamma_crtc_information_t* restrict out, libgam xcb_connection_t* restrict connection = crtc->partition->site->data; xcb_randr_crtc_t* restrict crtc_id = crtc->data; xcb_randr_get_crtc_gamma_size_cookie_t cookie; - xcb_randr_get_crtc_gamma_size_reply_t* reply; + xcb_randr_get_crtc_gamma_size_reply_t* restrict reply; xcb_generic_error_t* error; out->gamma_size_error = 0; @@ -588,8 +588,8 @@ static int get_connector_type(libgamma_crtc_information_t* restrict this) */ static int get_output_name(libgamma_crtc_information_t* restrict out, xcb_randr_get_output_info_reply_t* restrict output) { - char* store; - uint8_t* name; + char* restrict store; + uint8_t* restrict name; uint16_t length; size_t i; @@ -629,9 +629,9 @@ static int get_output_name(libgamma_crtc_information_t* restrict out, xcb_randr_ static int get_edid(libgamma_crtc_information_t* restrict out, libgamma_crtc_state_t* restrict crtc, xcb_randr_output_t output) { - xcb_connection_t* connection = crtc->partition->site->data; + xcb_connection_t* restrict connection = crtc->partition->site->data; xcb_randr_list_output_properties_cookie_t prop_cookie; - xcb_randr_list_output_properties_reply_t* prop_reply; + xcb_randr_list_output_properties_reply_t* restrict prop_reply; xcb_atom_t* atoms; xcb_atom_t* atoms_end; xcb_generic_error_t* error; @@ -658,12 +658,12 @@ static int get_edid(libgamma_crtc_information_t* restrict out, for (; atoms != atoms_end; atoms++) { xcb_get_atom_name_cookie_t atom_name_cookie; - xcb_get_atom_name_reply_t* atom_name_reply; - char* atom_name; + xcb_get_atom_name_reply_t* restrict atom_name_reply; + char* restrict atom_name; int atom_name_len; xcb_randr_get_output_property_cookie_t atom_cookie; - xcb_randr_get_output_property_reply_t* atom_reply; - unsigned char* atom_data; + xcb_randr_get_output_property_reply_t* restrict atom_reply; + unsigned char* restrict atom_data; int length; /* Acquire the atom name. */ @@ -747,10 +747,10 @@ int libgamma_x_randr_get_crtc_information(libgamma_crtc_information_t* restrict { #define _E(FIELD) ((fields & FIELD) ? LIBGAMMA_CRTC_INFO_NOT_SUPPORTED : 0) int e = 0; - xcb_randr_get_output_info_reply_t* output_info = NULL; + xcb_randr_get_output_info_reply_t* restrict output_info = NULL; xcb_randr_output_t output; int free_edid; - + /* Wipe all error indicators. */ memset(this, 0, sizeof(libgamma_crtc_information_t)); diff --git a/src/gamma-x-vidmode.c b/src/gamma-x-vidmode.c index 42bce6e..cbed77f 100644 --- a/src/gamma-x-vidmode.c +++ b/src/gamma-x-vidmode.c @@ -37,7 +37,7 @@ */ void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t* restrict this) { - char* display = getenv("DISPLAY"); + char* restrict display = getenv("DISPLAY"); this->crtc_information = CRTC_INFO_GAMMA_SIZE | CRTC_INFO_GAMMA_DEPTH; this->default_site_known = (display && *display); @@ -72,7 +72,7 @@ void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t* rest int libgamma_x_vidmode_site_initialise(libgamma_site_state_t* restrict this, char* restrict site) { - Display* connection = XOpenDisplay(site); + Display* restrict connection = XOpenDisplay(site); int _major, _minor, screens; if ((this->data = connection) == NULL) return LIBGAMMA_OPEN_SITE_FAILED; @@ -221,7 +221,7 @@ int libgamma_x_vidmode_get_crtc_information(libgamma_crtc_information_t* restric this->gamma_size_error = 0; if ((fields & CRTC_INFO_GAMMA_SUPPORT)) { - Display* connection = crtc->partition->site->data; + Display* restrict connection = crtc->partition->site->data; int stops; if (!XF86VidModeGetGammaRampSize(connection, (int)(crtc->partition->partition), &stops)) this->gamma_size_error = LIBGAMMA_GAMMA_RAMPS_SIZE_QUERY_FAILED; diff --git a/src/libgamma-facade.c b/src/libgamma-facade.c index 9f95c50..25a7ba8 100644 --- a/src/libgamma-facade.c +++ b/src/libgamma-facade.c @@ -168,7 +168,7 @@ static int libgamma_list_method_test(int method, int operation) * Other values invoke undefined behaviour. * @return The number of element that have been stored in `methods` */ -size_t libgamma_list_methods(int* methods, int operation) +size_t libgamma_list_methods(int* restrict methods, int operation) { #ifdef HAVE_NO_GAMMA_METHODS (void) methods; @@ -268,8 +268,8 @@ void libgamma_method_capabilities(libgamma_method_capabilities_t* restrict this, */ char* libgamma_method_default_site(int method) { - const char* var = libgamma_method_default_site_variable(method); - char* env; + const char* restrict var = libgamma_method_default_site_variable(method); + char* restrict env; if (var == NULL) return NULL; @@ -860,7 +860,7 @@ void libgamma_crtc_information_free(libgamma_crtc_information_t* restrict this) */ char* libgamma_behex_edid_lowercase(const unsigned char* restrict edid, size_t length) { - char* out = malloc((length * 2 + 1) * sizeof(char)); + char* restrict out = malloc((length * 2 + 1) * sizeof(char)); size_t i; if (out == NULL) @@ -887,7 +887,7 @@ char* libgamma_behex_edid_lowercase(const unsigned char* restrict edid, size_t l */ char* libgamma_behex_edid_uppercase(const unsigned char* restrict edid, size_t length) { - char* out = malloc((length * 2 + 1) * sizeof(char)); + char* restrict out = malloc((length * 2 + 1) * sizeof(char)); size_t i; if (out == NULL) @@ -917,7 +917,7 @@ unsigned char* libgamma_unhex_edid(const char* restrict edid) #define not_range(lower, V, upper) ((V < lower) || (upper < V)) #define is_not_hex(V) (not_range('0', V, '9') && not_range('a', V, 'f') && not_range('A', V, 'F')) - unsigned char* out = NULL; + unsigned char* restrict out = NULL; size_t n = strlen(edid); size_t i; diff --git a/src/libgamma-facade.h b/src/libgamma-facade.h index 830278a..ecc3b13 100644 --- a/src/libgamma-facade.h +++ b/src/libgamma-facade.h @@ -86,7 +86,7 @@ typedef double libgamma_gamma_rampsd_fun(double encoding); * Other values invoke undefined behaviour. * @return The number of element that have been stored in `methods` */ -size_t libgamma_list_methods(int* methods, int operation); +size_t libgamma_list_methods(int* restrict methods, int operation); /** * Return the capabilities of an adjustment method |