Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Borodin 6cb97d18f1 src/strutil/xstrtol.c: sync with gnulib.
Sync with gnulib 64ddc975e72cb55d2b2d755c25603bd70312aa5e:
  This patch alters xstrtoumax behavior slightly, in areas are not
  likely to affect any real callers, by making xstrtoumax behave more
  like the system strtol. In particular, it lets xstrtoumax support
  bases other than those required by POSIX, if the underlying
  implementation does; this removes the need for an g_assert().

  * lib/strutil/strtol.c: Do not include stdio.h.
  (xstrtoumax): Use same parameter names as POSIX, to make it
  easier for outsiders to follow. Do not require the base to be 0-36,
  as the underlying implementation is allowed to support other bases.

Sync with gnulib 16b33e6649425fcdce095f262da98b539d2f7448.

  * (xstrtoumax): Don't update *endptr if strtol doesn't.
  Also, if the underlying strtol gives an unusual error number and
  sets *endpnr = nptr, assume that's an error not a missing number.

Sync with gnulib bd1e981434c98751b1106a1744e77a27317b52b3
  * (xstrtoumax): Stop worrying about hypothetical implementations that
  are causing more confusion than the code is worth. Instead, go back
  more to old way of doing things.  None of this matters for practical
  applications.

Add commemt.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin 6718b3ec26 Indentation using GNU indent-2.2.13.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin fe42478b97 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-01-01 09:46:17 +03:00
Andrew Borodin 7257f794d2 Update template for .c files.
Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 3ad5f5502f Add Ronna (10^27), and Quetta (10^30) SI prefixes.
As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3

Sync with gnulib 0ad3ea4951f77835d02180021589f3a849d885f2.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin 9ee52e77c3 Ticket #4179: code clean up before 4.8.27 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andreas Mohr 57f5ab7c23 Add break before empty default in switch.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin 31b37a1f79 Ticket #4050: code cleanup before 4.8.25 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin 1dd8a47987 Ticket #3955: code cleanup before 4.8.23 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:44:40 +03:00
Andrew Borodin ddd645526a Update copyright years. 2018-02-04 11:30:22 +03:00
Andrew Borodin e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Andrew Borodin 9a39e35dc3 Use g_assert() instead of assert(3).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin bdb81cd482 Sync with gnulib 6ed53f13bc39d9a0252549e98a2a59441fb2351f.
lib/strutil/xstrtol.c: prohibit monstrosities like "1bB".

Problem reported by Young Mo Kang in: http://bugs.gnu.org/23388.

(xstrtoumax): Allow trailing second suffixes like "B" only if the first
suffix needs a base.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:28:47 +03:00
Andrew Borodin 471ea781ca Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:10 +03:00
Andrew Borodin 2789e6e390 Ticket #3431: add missing default cases.
Introduce -Wswitch-default check.

Some minor cosmetics.

Thanks Andreas Mohr <and at gmx dot li> for original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:50 +03:00
Andrew Borodin 454479549c Update copyright years. 2015-02-26 09:12:08 +03:00
Andrew Borodin e6030d8e74 Sync with gnulib 94ee038129c3b40510ef0ff6ac6ddfe85bf0f97f.
(xstrtoumax): use enum instead of 0, to pacify IRIX 6.5 cc.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-07-22 13:12:06 +04:00
Andrew Borodin e5203cb023 Fix name of FSF in all *.c files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Andrew Borodin 43bf10b170 Ticket #3167: copyright issues.
lib/strutil/xstrtol.c: restore copyright line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:16 +04:00
Andrew Borodin f0da49345a Collapse list of copyright years to ranges. Add 2014 year.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Andrew Borodin ccf82ada12 Add functions to transform string to unsigned integer:
* (xstrtoumax): from gnulib.
 * (parse_integer): from coreutils (dd.c).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-05 09:09:03 +04:00