mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Use VLA instead of heap alloc
This commit is contained in:
		
							parent
							
								
									0232269a2d
								
							
						
					
					
						commit
						dd69d7b764
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		| 
						 | 
					@ -199,7 +199,7 @@ static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
 | 
				
			||||||
static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
 | 
					static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
 | 
				
			||||||
		struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
 | 
							struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
 | 
				
			||||||
		uint32_t size) {
 | 
							uint32_t size) {
 | 
				
			||||||
	struct drm_color_lut *gamma = calloc(sizeof(struct drm_color_lut), size);
 | 
						struct drm_color_lut gamma[size];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (uint32_t i = 0; i < size; i++) {
 | 
						for (uint32_t i = 0; i < size; i++) {
 | 
				
			||||||
		gamma[i].red = r[i];
 | 
							gamma[i].red = r[i];
 | 
				
			||||||
| 
						 | 
					@ -214,12 +214,9 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
 | 
				
			||||||
	if (drmModeCreatePropertyBlob(drm->fd, gamma,
 | 
						if (drmModeCreatePropertyBlob(drm->fd, gamma,
 | 
				
			||||||
				sizeof(struct drm_color_lut) * size, &crtc->gamma_lut)) {
 | 
									sizeof(struct drm_color_lut) * size, &crtc->gamma_lut)) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "Unable to create property blob");
 | 
							wlr_log_errno(L_ERROR, "Unable to create property blob");
 | 
				
			||||||
		free(gamma);
 | 
					 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(gamma);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct atomic atom;
 | 
						struct atomic atom;
 | 
				
			||||||
	atomic_begin(crtc, &atom);
 | 
						atomic_begin(crtc, &atom);
 | 
				
			||||||
	atomic_add(&atom, crtc->id, crtc->props.gamma_lut, crtc->gamma_lut);
 | 
						atomic_add(&atom, crtc->id, crtc->props.gamma_lut, crtc->gamma_lut);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue