History log of /freebsd-src/lib/libutil/expand_number.c (Results 1 – 23 of 23)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/14.1.0, release/13.3.0
# a2f733ab 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remov

lib: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 08300d84 13-Jun-2023 Xin LI <delphij@FreeBSD.org>

expand_number: Tighten check of unit.

The current code silently ignores characters after the unit as long
the unit themselves were recognized. This commit makes expand_number(3)
to fail with EINVAL

expand_number: Tighten check of unit.

The current code silently ignores characters after the unit as long
the unit themselves were recognized. This commit makes expand_number(3)
to fail with EINVAL if buf did not terminate after the unit character.

Historically, the function accepts and ignores "B" as a SI unit, this
behavior is preserved and e.g. KB, MB are still accepted as aliases of
K and M, document this behavior in the manual page.

While I am there, also write a few test cases to validate the behavior.

Reviewed-by: emaste
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40482

show more ...


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# 5e53a4f9 26-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

lib: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
pr

lib: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

show more ...


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0, release/10.1.0, release/9.3.0, release/10.0.0
# 0bfd163f 18-Oct-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Merge head r233826 through r256722.


# 1ccca3b5 10-Oct-2013 Alan Somers <asomers@FreeBSD.org>

IFC @256277

Approved by: ken (mentor)


Revision tags: release/9.2.0
# ef90af83 20-Sep-2013 Peter Grehan <grehan@FreeBSD.org>

IFC @ r255692

Comment out IA32_MISC_ENABLE MSR access - this doesn't exist on AMD.
Need to sort out how arch-specific MSRs will be handled.


# d1d01586 05-Sep-2013 Simon J. Gerraty <sjg@FreeBSD.org>

Merge from head


# 46ed9e49 04-Sep-2013 Peter Grehan <grehan@FreeBSD.org>

IFC @ r255209


# f27c28dc 30-Aug-2013 Mark Murray <markm@FreeBSD.org>

MFC


# 8d99b9ce 30-Aug-2013 Sergey Kandaurov <pluknet@FreeBSD.org>

The round of expand_number() cleanups.
o Fix range error checking to detect overflow when uint64_t < uintmax_t.
o Remove a non-functional check for no valid digits as pointed out by Bruce.
o Remove a

The round of expand_number() cleanups.
o Fix range error checking to detect overflow when uint64_t < uintmax_t.
o Remove a non-functional check for no valid digits as pointed out by Bruce.
o Remove a rather pointless comment describing what the function does.
o Clean up a bunch of style bugs.

Brucified by: bde

show more ...


# d02f8fa8 22-Aug-2013 Mark Murray <markm@FreeBSD.org>

IFC.


# 7261b203 21-Aug-2013 Sergey Kandaurov <pluknet@FreeBSD.org>

Reset errno before strtoumax() call to properly detect ERANGE.
Restore saved errno if strtoumax() call is successful.

Reported by: ache
Reviewed by: jilles
MFC after: 1 week


# 869f2762 21-Aug-2013 Sergey Kandaurov <pluknet@FreeBSD.org>

Check strtoumax(3) for ERANGE in case of non-prefixed string.

OK'd by: silence on current@
MFC after: 1 week


Revision tags: release/8.4.0, release/9.1.0, release/8.3.0_cvs, release/8.3.0, release/9.0.0, release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0
# a2e0c5ae 15-Aug-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

Further simplify the code, and update the manpage.

Submitted by: Christoph Mallon <christoph.mallon@gmx.de>


# b6fbd4d5 15-Aug-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

no-op commit to note that the example given in the previous commit is
a very bad one, since the shift does not actually overflow. This is
a better example (assuming uint64_t = unsigned long long):

no-op commit to note that the example given in the previous commit is
a very bad one, since the shift does not actually overflow. This is
a better example (assuming uint64_t = unsigned long long):

~0LLU >> 9 = 0x7fffffffffffffLLU
~0LLU >> 9 << 10 = 0xfffffffffffffc00LLU
~0LLU >> 9 << 10 >> 10 = 0x3fffffffffffffLLU

show more ...


# 1035d740 15-Aug-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

Fix the overflow test. It is possible for the result of an
overflowing shift to be larger than the original value, e.g.

(uint64_t)1 << 53 = 0x20000000000000
((uint64_t)1 << 53) << 10 = 0x

Fix the overflow test. It is possible for the result of an
overflowing shift to be larger than the original value, e.g.

(uint64_t)1 << 53 = 0x20000000000000
((uint64_t)1 << 53) << 10 = 0x8000000000000000

show more ...


# bbb2703b 14-Aug-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

Simplify expand_number() by combining the (unrolled) loop with the
switch. Since expand_number() does not accept negative numbers, switch
from int64_t to uint64_t; this makes it easier to check for

Simplify expand_number() by combining the (unrolled) loop with the
switch. Since expand_number() does not accept negative numbers, switch
from int64_t to uint64_t; this makes it easier to check for overflow.

MFC after: 3 weeks

show more ...


Revision tags: release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0
# 2db44b84 07-Jul-2008 Konstantin Belousov <kib@FreeBSD.org>

Add #include <inttypes.h> for the strtoimax().

Submitted by: Jilles Tjoelker <jilles stack nl>
MFC after: 3 days


Revision tags: release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0
# 26fc3730 18-Nov-2007 John Birrell <jb@FreeBSD.org>

Constify the first argument to expand_number() so that it can
be called with a const without the compiler grisling.


# c0a6ac3f 05-Sep-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Fix strange for loop.

Reported by: phk

- While here, check the unit before calculating the actually number.
This way we can return EINVAL for invalid unit instead of ERANGE.

Approved by: re

- Fix strange for loop.

Reported by: phk

- While here, check the unit before calculating the actually number.
This way we can return EINVAL for invalid unit instead of ERANGE.

Approved by: re (kensmith)

show more ...


# bd35b57d 01-Sep-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Implement expand_number(3), which is the opposite of humanize_number(3), ie.
a number in human-readable form is converted to int64_t, for example:
123b -> 123
10k -> 10240
16G -> 17179869184

First v

Implement expand_number(3), which is the opposite of humanize_number(3), ie.
a number in human-readable form is converted to int64_t, for example:
123b -> 123
10k -> 10240
16G -> 17179869184

First version submitted by: Eric Anderson <anderson@freebsd.org>
Approved by: re (bmah)

show more ...