[lttng-dev] [PATCH] add_context.c : Document return values, simplify session_name assignment in cmd_add_context()

David Goulet dgoulet at efficios.com
Wed Feb 1 12:50:25 EST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Again, after rc1.

Thanks
David

On 12-01-31 02:04 PM, Thibault, Daniel wrote:
> From 46d00e14190d536f428c25c0e969dde051845a48 Tue, 31 Jan 2012 14:02:51 -0500
> From: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
> Date: Tue, 31 Jan 2012 14:02:00 -0500
> Subject: [PATCH] add_context.c : Document return values, simplify session_name assignment in cmd_add_context()
> 
> Signed-off-by: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
> 
> diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c
> index ce65024..2f6f11c 100644
> --- a/src/bin/lttng/commands/add_context.c
> +++ b/src/bin/lttng/commands/add_context.c
> @@ -340,7 +340,8 @@
>  }
>  
>  /*
> - * Find context numerical value from string.
> + * Find context numerical value from string (which must not be NULL).
> + * Returns -1 if not found.
>   */
>  static int find_ctx_type_idx(const char *opt)
>  {
> @@ -360,6 +361,7 @@
>  
>  /*
>   * Add context to channel or event.
> + * Returns a CMD_* result.
>   */
>  static int add_context(char *session_name)
>  {
> @@ -445,6 +447,7 @@
>  
>  /*
>   * Add context to channel or event.
> + * Returns one of the CMD_* result values.
>   */
>  int cmd_add_context(int argc, const char **argv)
>  {
> @@ -514,14 +517,10 @@
>  		}
>  	}
>  
> -	if (!opt_session_name) {
> -		session_name = get_session_name();
> -		if (session_name == NULL) {
> -			ret = CMD_ERROR;
> -			goto end;
> -		}
> -	} else {
> -		session_name = opt_session_name;
> +	session_name = (opt_session_name ? opt_session_name : get_session_name() );
> +	if (session_name == NULL) {
> +		ret = CMD_ERROR;
> +		goto end;
>  	}
>  
>  	ret = add_context(session_name);
> ------------------------------
> 
> Daniel U. Thibault
> R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
> Système de systèmes (SdS) / System of Systems (SoS)
> Solutions informatiques et expérimentations (SIE) / Computing Solutions and Experimentations (CSE)
> 2459 Boul. Pie XI Nord
> Québec, QC  G3J 1X5
> CANADA
> Vox : (418) 844-4000 x4245
> Fax : (418) 844-4538
> NAC: 918V QSDJ
> Gouvernement du Canada / Government of Canada
> <http://www.valcartier.drdc-rddc.gc.ca/>
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJPKXthAAoJEELoaioR9I02Fa4H/2Y7owy0pKQVSu+Otxaw9ytO
ETpzmGIhXv25XY2kfvnvL5FPY+iYzxccv3ssudazggXkFzWEBMgzr/kSVnL8gYcF
MzHoJ8lJ7qOtSN8X07ii6g8H62a2L0+17DkX0PdYq3ztoSSHCC8LPBpMKblWPoGF
yUb70SY07QaTy3CEFeap9IBqA+jf0hjVrM9wVnqqdWTLrDdTmLwHC1YY57clm6QJ
ZgeIfx9GMFjq4qja3kMjgCoEWNrN7j4Bbq6I3BFVEWLZMXlSjbICiwqx9BM3Llly
eQRATM4+eZtN2GXOTInf/nNZ/m8G5TSK/vO2/8AkI4xCUTVDRt9zVMdWUCO3Es0=
=vFG6
-----END PGP SIGNATURE-----



More information about the lttng-dev mailing list