Mercurial > emacs
comparison src/doprnt.c @ 12797:f0724d9d625e
(doprnt): Don't let size_bound be gigantic. Fix error message.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Aug 1995 17:52:16 +0000 |
parents | ac7375e60931 |
children | cc26e7c955cc |
comparison
equal
deleted
inserted
replaced
12796:20e4ad629f4d | 12797:f0724d9d625e |
---|---|
102 /* Avoid pitfall of negative "size" parameter ("%-200d"). */ | 102 /* Avoid pitfall of negative "size" parameter ("%-200d"). */ |
103 if (size_bound < 0) | 103 if (size_bound < 0) |
104 size_bound = -size_bound; | 104 size_bound = -size_bound; |
105 size_bound += 50; | 105 size_bound += 50; |
106 | 106 |
107 if (size_bound > bufsize) | |
108 /* This is certainly enough that it doesn't matter | |
109 to lose the rest. */ | |
110 size_bound = bufsize + 100; | |
111 | |
107 /* Make sure we have that much. */ | 112 /* Make sure we have that much. */ |
108 if (size_bound > size_allocated) | 113 if (size_bound > size_allocated) |
109 { | 114 { |
110 if (big_buffer) | 115 if (big_buffer) |
111 big_buffer = (char *) xrealloc (big_buffer, size_bound); | 116 big_buffer = (char *) xrealloc (big_buffer, size_bound); |
123 /* case 'b': */ | 128 /* case 'b': */ |
124 case 'd': | 129 case 'd': |
125 case 'o': | 130 case 'o': |
126 case 'x': | 131 case 'x': |
127 if (cnt == nargs) | 132 if (cnt == nargs) |
128 error ("not enough arguments for format string"); | 133 error ("Not enough arguments for format string"); |
129 if (sizeof (int) == sizeof (EMACS_INT)) | 134 if (sizeof (int) == sizeof (EMACS_INT)) |
130 ; | 135 ; |
131 else if (sizeof (long) == sizeof (EMACS_INT)) | 136 else if (sizeof (long) == sizeof (EMACS_INT)) |
132 /* Insert an `l' the right place. */ | 137 /* Insert an `l' the right place. */ |
133 string[1] = string[0], | 138 string[1] = string[0], |