Deleted Added
full compact
strings.c (42625) strings.c (74769)
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
35static char sccsid[] = "@(#)strings.c 8.1 (Berkeley) 6/6/93";
36static char sccsid[] = "@(#)strings.c 8.1 (Berkeley) 6/6/93";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/usr.bin/mail/strings.c 74769 2001-03-25 04:57:05Z mikeh $";
36#endif /* not lint */
37
38/*
39 * Mail -- a mail program
40 *
41 * String allocation routines.
42 * Strings handed out here are reclaimed at the top of the command
43 * loop each time, so they need not be freed.

--- 26 unchanged lines hidden (view full) ---

70 for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
71 if (sp->s_topFree == NOSTR && (STRINGSIZE << index) >= s)
72 break;
73 if (sp->s_nleft >= s)
74 break;
75 index++;
76 }
77 if (sp >= &stringdope[NSPACE])
40#endif /* not lint */
41
42/*
43 * Mail -- a mail program
44 *
45 * String allocation routines.
46 * Strings handed out here are reclaimed at the top of the command
47 * loop each time, so they need not be freed.

--- 26 unchanged lines hidden (view full) ---

74 for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
75 if (sp->s_topFree == NOSTR && (STRINGSIZE << index) >= s)
76 break;
77 if (sp->s_nleft >= s)
78 break;
79 index++;
80 }
81 if (sp >= &stringdope[NSPACE])
78 panic("String too large");
82 errx(1, "String too large");
79 if (sp->s_topFree == NOSTR) {
80 index = sp - &stringdope[0];
83 if (sp->s_topFree == NOSTR) {
84 index = sp - &stringdope[0];
81 sp->s_topFree = malloc(STRINGSIZE << index);
82 if (sp->s_topFree == NOSTR) {
83 fprintf(stderr, "No room for space %d\n", index);
84 panic("Internal error");
85 }
85 if ((sp->s_topFree = malloc(STRINGSIZE << index)) == NOSTR)
86 err(1, "No room for space %d", index);
86 sp->s_nextFree = sp->s_topFree;
87 sp->s_nleft = STRINGSIZE << index;
88 }
89 sp->s_nleft -= s;
90 t = sp->s_nextFree;
91 sp->s_nextFree += s;
92 return(t);
93}

--- 36 unchanged lines hidden ---
87 sp->s_nextFree = sp->s_topFree;
88 sp->s_nleft = STRINGSIZE << index;
89 }
90 sp->s_nleft -= s;
91 t = sp->s_nextFree;
92 sp->s_nextFree += s;
93 return(t);
94}

--- 36 unchanged lines hidden ---