"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: diff.git: remove ternary if extension
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Wed, 31 Aug 2022 14:11:29 +0200

Download raw body.

Thread
On Wed, Aug 31, 2022 at 10:04:53PM +1000, Mark Jamsek wrote:
> Remove gcc ternary if extension:
> 
> -----------------------------------------------
> commit 1a78df5e80ac90a97e96a9733adcdf92b3b8bea2 (main)
> from: Mark Jamsek <mark@jamsek.dev>
> date: Tue Aug 30 23:21:01 2022 UTC
>  
>  remove gcc ternary if extension

Yes, thanks!

> diff b1aa94aab8c556c9614a18b8e13c6cc8c3005b79 1a78df5e80ac90a97e96a9733adcdf92b3b8bea2
> commit - b1aa94aab8c556c9614a18b8e13c6cc8c3005b79
> commit + 1a78df5e80ac90a97e96a9733adcdf92b3b8bea2
> blob - 8b503d2f97ddd5ce74010697dc9c40b1e8a4b7af
> blob + 376ca751ab3e90181519012a124c167c699a1fb9
> --- include/arraylist.h
> +++ include/arraylist.h
> @@ -65,7 +65,8 @@
>  				(ARRAY_LIST).allocated + \
>  				((ARRAY_LIST).allocated ? \
>  				(ARRAY_LIST).allocated / 2 : \
> -				(ARRAY_LIST).alloc_blocksize ? : 8), \
> +				(ARRAY_LIST).alloc_blocksize ?
> +				(ARRAY_LIST).alloc_blocksize : 8), \
>  				sizeof(*(ARRAY_LIST).head)); \
>  			if ((ARRAY_LIST).p == NULL) { \
>  				NEW_ITEM_P = NULL; \
> @@ -74,7 +75,8 @@
>  			(ARRAY_LIST).allocated += \
>  				(ARRAY_LIST).allocated ? \
>  				(ARRAY_LIST).allocated / 2 : \
> -				(ARRAY_LIST).alloc_blocksize ? : 8, \
> +				(ARRAY_LIST).alloc_blocksize ?
> +				(ARRAY_LIST).alloc_blocksize : 8, \
>  			(ARRAY_LIST).head = (ARRAY_LIST).p; \
>  			(ARRAY_LIST).p = NULL; \
>  		}; \
> blob - 77f774c3d3737b31b6f815a4434406dd96458a69
> blob + f31fda0d4f1ddf7e3bc6342344086510e3539eb2
> --- lib/diff_main.c
> +++ lib/diff_main.c
> @@ -602,7 +602,8 @@ diff_main(const struct diff_config *config, struct dif
>  
>  	struct diff_state state = {
>  		.result = result,
> -		.recursion_depth_left = config->max_recursion_depth ? : UINT_MAX,
> +		.recursion_depth_left = config->max_recursion_depth ?
> +		    config->max_recursion_depth : UINT_MAX,
>  		.kd_buf = NULL,
>  		.kd_buf_size = 0,
>  	};
> blob - f9f748fd298e5716a0fbfa2a0ff0277abc7a331e
> blob + 3047221aa5a15e4fc2a5dea8267e97864da21264
> --- lib/diff_output.c
> +++ lib/diff_output.c
> @@ -365,7 +365,7 @@ diff_output_get_label_left(const struct diff_input_inf
>  	if (info->flags & DIFF_INPUT_LEFT_NONEXISTENT)
>  		return "/dev/null";
>  
> -	return info->left_path ? : "a";
> +	return info->left_path ? info->left_path : "a";
>  }
>  
>  const char *
> @@ -374,5 +374,5 @@ diff_output_get_label_right(const struct diff_input_in
>  	if (info->flags & DIFF_INPUT_RIGHT_NONEXISTENT)
>  		return "/dev/null";
>  
> -	return info->right_path ? : "b";
> +	return info->right_path ? info->right_path : "b";
>  }
> 
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68