Hi!
> +static void consume(int mega)
> +{
> +     size_t sz;
> +     void *ptr;
> +
> +     sz  = mega * 1024 * 1024;
> +     ptr = SAFE_MALLOC(cleanup, sz);
> +     memset(ptr, 0, sz);
> +}
> +
> +static long get_long(const char *str)
> +{
> +     long val;
> +     char *endptr;
> +
> +     val = strtol(str, &endptr, 10);
> +     if (((val == LONG_MAX || val == LONG_MIN) && errno == ERANGE) ||
> +                 (errno != 0 && val == 0))
> +             tst_brkm(TBROK|TERRNO, cleanup, "strtol");
> +     if (endptr == str || *endptr != '\0')
> +             tst_brkm(TBROK, cleanup, "Non-digits were found.");
> +
> +     return val;
> +}

One more thing, please keep the error meesages sweet and to the point.

Just imagine you get "Non-digits were found." error from some utility.
Which doesn't say much, for example where was these non digits found.

I would do something like:

tst_brkm(TBROK, "Invalid number parameter '%s'", str);

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to