From 1072a8797e838032a449dc475317250f328e8e81 Mon Sep 17 00:00:00 2001 From: Ceriel Jacobs Date: Wed, 15 Jun 2011 11:13:48 +0200 Subject: [PATCH] Added atol() that ignores overflow, so that unsigned long constants are dealt with properly --- util/ass/assci.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/util/ass/assci.c b/util/ass/assci.c index 52a6484e5..d3d0b9692 100644 --- a/util/ass/assci.c +++ b/util/ass/assci.c @@ -849,8 +849,28 @@ extxcon(header) { return ; } +/* Added atol() that ignores overflow. --Ceriel */ +long atol(s) + register char *s; +{ + register long total = 0; + register unsigned digit; + int minus = 0; + + while (*s == ' ' || *s == '\t') s++; + if (*s == '+') s++; + else if (*s == '-') { + s++; + minus = 1; + } + while ((digit = *s++ - '0') < 10) { + total *= 10; + total += digit; + } + return(minus ? -total : total); +} + extvcon(header) { - extern long atol() ; /* * generate data for a constant initialized by a string. */ -- 2.34.1