4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / mail / strings.c
index bb7b429..bfdd52b 100644 (file)
@@ -1,18 +1,13 @@
 /*
 /*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
+ * %sccs.include.redist.c%
  */
 
  */
 
-#ifdef notdef
-static char sccsid[] = "@(#)strings.c  5.5 (Berkeley) %G%";
-#endif /* notdef */
+#ifndef lint
+static char sccsid[] = "@(#)strings.c  8.1 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * Mail -- a mail program
 
 /*
  * Mail -- a mail program
@@ -23,6 +18,7 @@ static char sccsid[] = "@(#)strings.c 5.5 (Berkeley) %G%";
  */
 
 #include "rcv.h"
  */
 
 #include "rcv.h"
+#include "extern.h"
 
 /*
  * Allocate size more bytes of space and return the address of the
 
 /*
  * Allocate size more bytes of space and return the address of the
@@ -34,6 +30,7 @@ static char sccsid[] = "@(#)strings.c 5.5 (Berkeley) %G%";
 
 char *
 salloc(size)
 
 char *
 salloc(size)
+       int size;
 {
        register char *t;
        register int s;
 {
        register char *t;
        register int s;
@@ -55,8 +52,7 @@ salloc(size)
                panic("String too large");
        if (sp->s_topFree == NOSTR) {
                index = sp - &stringdope[0];
                panic("String too large");
        if (sp->s_topFree == NOSTR) {
                index = sp - &stringdope[0];
-               sp->s_topFree = (char *) calloc(STRINGSIZE << index,
-                   (unsigned) 1);
+               sp->s_topFree = malloc(STRINGSIZE << index);
                if (sp->s_topFree == NOSTR) {
                        fprintf(stderr, "No room for space %d\n", index);
                        panic("Internal error");
                if (sp->s_topFree == NOSTR) {
                        fprintf(stderr, "No room for space %d\n", index);
                        panic("Internal error");
@@ -75,7 +71,7 @@ salloc(size)
  * Called to free all strings allocated
  * since last reset.
  */
  * Called to free all strings allocated
  * since last reset.
  */
-
+void
 sreset()
 {
        register struct strings *sp;
 sreset()
 {
        register struct strings *sp;
@@ -83,7 +79,6 @@ sreset()
 
        if (noreset)
                return;
 
        if (noreset)
                return;
-       minit();
        index = 0;
        for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
                if (sp->s_topFree == NOSTR)
        index = 0;
        for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
                if (sp->s_topFree == NOSTR)
@@ -93,3 +88,16 @@ sreset()
                index++;
        }
 }
                index++;
        }
 }
+
+/*
+ * Make the string area permanent.
+ * Meant to be called in main, after initialization.
+ */
+void
+spreserve()
+{
+       register struct strings *sp;
+
+       for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++)
+               sp->s_topFree = NOSTR;
+}