aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:04:45 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:04:45 +0300
commitdbd583bd2b8a6dd40c622875a4e197360cb5aba7 (patch)
treed9fb7b6595cb44fefb4e32d70af9ac6d057af14a /builtin.c
parentb8c608200919aa3f7b3fef289a7bece2d2961412 (diff)
downloadegawk-dbd583bd2b8a6dd40c622875a4e197360cb5aba7.tar.gz
egawk-dbd583bd2b8a6dd40c622875a4e197360cb5aba7.tar.bz2
egawk-dbd583bd2b8a6dd40c622875a4e197360cb5aba7.zip
Move to 2.13.3 (from 2.13.tar.gz - sigh).
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin.c b/builtin.c
index 9465ba1f..c2e28e52 100644
--- a/builtin.c
+++ b/builtin.c
@@ -10,8 +10,8 @@
*
* GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or (at your option)
- * any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,7 +20,7 @@
*
* You should have received a copy of the GNU General Public License
* along with GAWK; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "awk.h"
@@ -983,19 +983,17 @@ int global;
}
text = t->stptr;
textlen = t->stlen;
+ buflen = textlen + 2;
s = force_string(tree_eval(s));
repl = s->stptr;
replend = repl + s->stlen;
repllen = replend - repl;
if (repllen == 0) { /* replacement is null string */
- buflen = textlen;
buf = text; /* so do subs. in place */
inplace = 1;
- } else {
- buflen = textlen * 2; /* initial guess -- adjusted later */
+ } else
emalloc(buf, char *, buflen, "do_sub");
- }
ampersands = 0;
for (scan = repl; scan < replend; scan++) {
if (*scan == '&') {