~ubuntu-branches/ubuntu/saucy/curl/saucy-201307251546

« back to all changes in this revision

Viewing changes to src/tool_paramhlp.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-03-23 16:24:51 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: package-import@ubuntu.com-20120323162451-z4gstlabjkgnrh7h
Tags: upstream-7.25.0
ImportĀ upstreamĀ versionĀ 7.25.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
 * Parse the string and write the integer in the given address. Return
152
152
 * non-zero on failure, zero on success.
153
153
 *
154
 
 * The string must start with a digit to be valid.
155
 
 *
156
154
 * Since this function gets called with the 'nextarg' pointer from within the
157
155
 * getparameter a lot, we must check it for NULL before accessing the str
158
156
 * data.
160
158
 
161
159
int str2num(long *val, const char *str)
162
160
{
163
 
  if(str && ISDIGIT(*str)) {
 
161
  if(str) {
164
162
    char *endptr;
165
163
    long num = strtol(str, &endptr, 10);
166
164
    if((endptr != str) && (endptr == str + strlen(str))) {