comparison src/alloc.c @ 106950:ddd257e3f816

Make string pointer args point to const as in other string allocation functions. * lisp.h (make_pure_string): String pointer arg now points to const. * alloc.c (find_string_data_in_pure, make_pure_string): String pointer args now point to const.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 22 Jan 2010 18:10:04 +0900
parents 1d1d5d9bd884
children 3447e262f426 d14945d39811
comparison
equal deleted inserted replaced
106949:86ae2a69cf52 106950:ddd257e3f816
4723 the non-Lisp data pool of the pure storage, and return its start 4723 the non-Lisp data pool of the pure storage, and return its start
4724 address. Return NULL if not found. */ 4724 address. Return NULL if not found. */
4725 4725
4726 static char * 4726 static char *
4727 find_string_data_in_pure (data, nbytes) 4727 find_string_data_in_pure (data, nbytes)
4728 char *data; 4728 const char *data;
4729 int nbytes; 4729 int nbytes;
4730 { 4730 {
4731 int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; 4731 int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max;
4732 unsigned char *p; 4732 const unsigned char *p;
4733 char *non_lisp_beg; 4733 char *non_lisp_beg;
4734 4734
4735 if (pure_bytes_used_non_lisp < nbytes + 1) 4735 if (pure_bytes_used_non_lisp < nbytes + 1)
4736 return NULL; 4736 return NULL;
4737 4737
4738 /* Set up the Boyer-Moore table. */ 4738 /* Set up the Boyer-Moore table. */
4739 skip = nbytes + 1; 4739 skip = nbytes + 1;
4740 for (i = 0; i < 256; i++) 4740 for (i = 0; i < 256; i++)
4741 bm_skip[i] = skip; 4741 bm_skip[i] = skip;
4742 4742
4743 p = (unsigned char *) data; 4743 p = (const unsigned char *) data;
4744 while (--skip > 0) 4744 while (--skip > 0)
4745 bm_skip[*p++] = skip; 4745 bm_skip[*p++] = skip;
4746 4746
4747 last_char_skip = bm_skip['\0']; 4747 last_char_skip = bm_skip['\0'];
4748 4748
4752 /* See the comments in the function `boyer_moore' (search.c) for the 4752 /* See the comments in the function `boyer_moore' (search.c) for the
4753 use of `infinity'. */ 4753 use of `infinity'. */
4754 infinity = pure_bytes_used_non_lisp + 1; 4754 infinity = pure_bytes_used_non_lisp + 1;
4755 bm_skip['\0'] = infinity; 4755 bm_skip['\0'] = infinity;
4756 4756
4757 p = (unsigned char *) non_lisp_beg + nbytes; 4757 p = (const unsigned char *) non_lisp_beg + nbytes;
4758 start = 0; 4758 start = 0;
4759 do 4759 do
4760 { 4760 {
4761 /* Check the last character (== '\0'). */ 4761 /* Check the last character (== '\0'). */
4762 do 4762 do
4794 a large string it may be able to hold conses that point to that 4794 a large string it may be able to hold conses that point to that
4795 string; then the string is not protected from gc. */ 4795 string; then the string is not protected from gc. */
4796 4796
4797 Lisp_Object 4797 Lisp_Object
4798 make_pure_string (data, nchars, nbytes, multibyte) 4798 make_pure_string (data, nchars, nbytes, multibyte)
4799 char *data; 4799 const char *data;
4800 int nchars, nbytes; 4800 int nchars, nbytes;
4801 int multibyte; 4801 int multibyte;
4802 { 4802 {
4803 Lisp_Object string; 4803 Lisp_Object string;
4804 struct Lisp_String *s; 4804 struct Lisp_String *s;