Re: [PATCH v4 03/13] parseopt: make OPT_INTEGER support hexadecimal as well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> -		*(int *)opt->value = strtol(arg, (char **)&s, 10);
> +		if (!prefixcmp(arg, "0x") || !prefixcmp(arg, "0X"))
> +			*(int *)opt->value = strtol(arg + 2, (char **)&s, 16);
> +		else
> +			*(int *)opt->value = strtol(arg, (char **)&s, 10);

Can't you just do "strtol(arg, (char **)&s, 0)" instead?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]