public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: ltp-list@lists.sourceforge.net
Cc: Alexey Kodanev <alexey.kodanev@oracle.com>, vasily.isaenko@oracle.com
Subject: Re: [LTP] [PATCH 4/4] lib: add tst_res_r.c
Date: Thu, 13 Feb 2014 03:47:57 -0500	[thread overview]
Message-ID: <5757763.zAWEHsmlGc@vapier> (raw)
In-Reply-To: <1392112090-13853-3-git-send-email-alexey.kodanev@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 1095 bytes --]

On Tuesday, February 11, 2014 13:48:10 Alexey Kodanev wrote:
> +static int get_tst_count()

random note: never never never use () with functions.  always always always 
use (void).  i'm guessing you're not aware, but what you've written here may 
be called (warning free!) like so:
	get_tst_count(1, 2, 3);

yes, even with -W -Wall -Wextra.  please stamp this horrible habit out of your 
code.

> +	/*
> +	 * Build the result line and print it.
> +	 */
> +	type = strttype(ttype);
> +	if (T_mode == VERBOSE) {
> +		size = snprintf(message, sizeof(message),
> +				"%-8s %4d  %s  :  %s", tcid, tnum, type, tmesg);
> +	} else {
> +		size = snprintf(message, sizeof(message),
> +				"%-8s %4d       %s  :  %s",
> +				tcid, tnum, type, tmesg);
> +	}
> +
> +	if (size >= sizeof(message)) {
> +		printf("%s: %i: line too long\n", __func__, __LINE__);
> +		abort();
> +	}

ugh, the 90's called and they want their staticly defined stack buffers back.  
use asprintf() and throw this historical wart in the trash where it belongs.

i've cleaned up tst_res.c some.
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 382 bytes --]

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2014-02-13  8:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11  9:48 [LTP] [PATCH v2 2/4] lib/test.h: create macro to declare init/cleanup functions Alexey Kodanev
2014-02-11  9:48 ` [LTP] [PATCH v2 3/4] lib: compile *_r.c to libltp_r library, add testcases_r.mk Alexey Kodanev
2014-02-11  9:48 ` [LTP] [PATCH 4/4] lib: add tst_res_r.c Alexey Kodanev
2014-02-12 15:44   ` chrubis
     [not found]     ` <5128140.KmexAZrTeg@vapier>
2014-02-13 10:21       ` chrubis
     [not found]         ` <52FCA8DF.4030503@oracle.com>
2014-02-13 13:04           ` chrubis
2014-02-13  8:47   ` Mike Frysinger [this message]
2014-02-13 10:05     ` Alexey Kodanev
2014-02-13 23:06       ` Mike Frysinger
2014-02-14 13:59         ` Alexey Kodanev
2014-02-14 17:16           ` Mike Frysinger
2014-02-19 15:19         ` chrubis
2014-02-13 10:11     ` chrubis
2014-02-12 15:37 ` [LTP] [PATCH v2 2/4] lib/test.h: create macro to declare init/cleanup functions chrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5757763.zAWEHsmlGc@vapier \
    --to=vapier@gentoo.org \
    --cc=alexey.kodanev@oracle.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=vasily.isaenko@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox