Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f03dc6ef
Commit
f03dc6ef
authored
Jun 18, 2011
by
Paul Eggert
Browse files
* fns.c: Use much-faster test for byte-length change.
parent
b4e50fa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
src/ChangeLog
src/ChangeLog
+1
-0
src/fns.c
src/fns.c
+5
-9
No files found.
src/ChangeLog
View file @
f03dc6ef
2011-06-18 Paul Eggert <eggert@cs.ucla.edu>
2011-06-18 Paul Eggert <eggert@cs.ucla.edu>
* fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
* fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
Use much-faster test for byte-length change.
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
* alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
...
...
src/fns.c
View file @
f03dc6ef
...
@@ -23,6 +23,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
...
@@ -23,6 +23,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <time.h>
#include <time.h>
#include <setjmp.h>
#include <setjmp.h>
#include <intprops.h>
#include "lisp.h"
#include "lisp.h"
#include "commands.h"
#include "commands.h"
#include "character.h"
#include "character.h"
...
@@ -2167,17 +2169,11 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
...
@@ -2167,17 +2169,11 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
unsigned char str[MAX_MULTIBYTE_LENGTH];
unsigned char str[MAX_MULTIBYTE_LENGTH];
int len = CHAR_STRING (charval, str);
int len = CHAR_STRING (charval, str);
EMACS_INT size_byte = SBYTES (array);
EMACS_INT size_byte = SBYTES (array);
unsigned char *p1 = p, *endp = p + size_byte;
int i;
int i;
if (size != size_byte)
if (INT_MULTIPLY_OVERFLOW (SCHARS (array), len)
while (p1 < endp)
|| SCHARS (array) * len != size_byte)
{
error ("Attempt to change byte length of a string");
int this_len = BYTES_BY_CHAR_HEAD (*p1);
if (len != this_len)
error ("Attempt to change byte length of a string");
p1 += this_len;
}
for (i = 0; i < size_byte; i++)
for (i = 0; i < size_byte; i++)
*p++ = str[i % len];
*p++ = str[i % len];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment