mirror of
https://github.com/curl/curl.git
synced 2026-08-03 02:40:29 +03:00
src: replace strto[u][ld] with curlx_str_ parsers
- Better error handling (no errno mess), better limit checks. - Also removed all uses of curlx_strtoofft() Closes #16634
This commit is contained in:
parent
f3b599a7e2
commit
8dca3b0656
12 changed files with 150 additions and 205 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
|
||||
#include "terminal.h"
|
||||
#include "strtoofft.h"
|
||||
|
||||
#include "memdebug.h" /* keep this as LAST include */
|
||||
|
||||
|
|
@ -47,10 +48,9 @@ unsigned int get_terminal_columns(void)
|
|||
unsigned int width = 0;
|
||||
char *colp = curl_getenv("COLUMNS");
|
||||
if(colp) {
|
||||
char *endptr;
|
||||
long num = strtol(colp, &endptr, 10);
|
||||
if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 20) &&
|
||||
(num < 10000))
|
||||
curl_off_t num;
|
||||
const char *p = colp;
|
||||
if(!curlx_str_number(&p, &num, 10000) && (num > 20))
|
||||
width = (unsigned int)num;
|
||||
curl_free(colp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue