summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsl <sl@stanleylieber.com>2021-02-19 21:15:15 -0500
committersl <sl@stanleylieber.com>2021-02-19 21:15:15 -0500
commit29e8ea26f2f9af2b9924e16dffd784bc5ae5685e (patch)
tree2610ddbaf1ace93abb59ead96fb5a9626ebeb627
parentbc1cc79225f0b006dd66d4fd81030d06f83bfca2 (diff)
downloadplan9front-29e8ea26f2f9af2b9924e16dffd784bc5ae5685e.tar.xz
sam/{address.c, sam.h}: bump STRSIZE to 512MB (thanks, Ori_B)
-rw-r--r--sys/src/cmd/sam/address.c9
-rw-r--r--sys/src/cmd/sam/sam.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/src/cmd/sam/address.c b/sys/src/cmd/sam/address.c
index a071b4a70..6176b582e 100644
--- a/sys/src/cmd/sam/address.c
+++ b/sys/src/cmd/sam/address.c
@@ -143,14 +143,16 @@ matchfile(String *r)
int
filematch(File *f, String *r)
{
- char *c, buf[STRSIZE+100];
+ char *c, *s;
String *t;
c = Strtoc(&f->name);
- sprint(buf, "%c%c%c %s\n", " '"[f->mod],
+ s = smprint("%c%c%c %s\n", " '"[f->mod],
"-+"[f->rasp!=0], " ."[f==curfile], c);
+ if(s == nil)
+ error(Etoolong);
free(c);
- t = tmpcstr(buf);
+ t = tmpcstr(s);
Strduplstr(&genstr, t);
freetmpstr(t);
/* A little dirty... */
@@ -159,6 +161,7 @@ filematch(File *f, String *r)
bufreset(menu);
bufinsert(menu, 0, genstr.s, genstr.n);
compile(r);
+ free(s);
return execute(menu, 0, menu->nc);
}
diff --git a/sys/src/cmd/sam/sam.h b/sys/src/cmd/sam/sam.h
index ae79a4bba..e9013c55b 100644
--- a/sys/src/cmd/sam/sam.h
+++ b/sys/src/cmd/sam/sam.h
@@ -18,7 +18,7 @@
#define INFINITY 0x7FFFFFFFL
#define INCR 25
-#define STRSIZE (2*BLOCKSIZE)
+#define STRSIZE (512<<20)
typedef long Posn; /* file position or address */
typedef ushort Mod; /* modification number */