Mercurial > emacs
comparison src/alloc.c @ 9942:c189487b08dd
(free_float): Don't assume XFASTINT accesses the raw bits.
(make_float, free_cons, Fcons, Fmake_symbol, gc_sweep): Likewise.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Tue, 15 Nov 1994 21:44:10 +0000 |
| parents | 2a9f99682f82 |
| children | e0672d4cf470 |
comparison
equal
deleted
inserted
replaced
| 9941:6d82f17895cf | 9942:c189487b08dd |
|---|---|
| 433 | 433 |
| 434 /* Explicitly free a float cell. */ | 434 /* Explicitly free a float cell. */ |
| 435 free_float (ptr) | 435 free_float (ptr) |
| 436 struct Lisp_Float *ptr; | 436 struct Lisp_Float *ptr; |
| 437 { | 437 { |
| 438 XSETFASTINT (ptr->type, (EMACS_INT) float_free_list); | 438 *(struct Lisp_Float **)&ptr->type = float_free_list; |
| 439 float_free_list = ptr; | 439 float_free_list = ptr; |
| 440 } | 440 } |
| 441 | 441 |
| 442 Lisp_Object | 442 Lisp_Object |
| 443 make_float (float_value) | 443 make_float (float_value) |
| 446 register Lisp_Object val; | 446 register Lisp_Object val; |
| 447 | 447 |
| 448 if (float_free_list) | 448 if (float_free_list) |
| 449 { | 449 { |
| 450 XSETFLOAT (val, float_free_list); | 450 XSETFLOAT (val, float_free_list); |
| 451 float_free_list = (struct Lisp_Float *) XFASTINT (float_free_list->type); | 451 float_free_list = *(struct Lisp_Float **)&float_free_list->type; |
| 452 } | 452 } |
| 453 else | 453 else |
| 454 { | 454 { |
| 455 if (float_block_index == FLOAT_BLOCK_SIZE) | 455 if (float_block_index == FLOAT_BLOCK_SIZE) |
| 456 { | 456 { |
| 506 | 506 |
| 507 /* Explicitly free a cons cell. */ | 507 /* Explicitly free a cons cell. */ |
| 508 free_cons (ptr) | 508 free_cons (ptr) |
| 509 struct Lisp_Cons *ptr; | 509 struct Lisp_Cons *ptr; |
| 510 { | 510 { |
| 511 XSETFASTINT (ptr->car, (EMACS_INT) cons_free_list); | 511 *(struct Lisp_Cons **)&ptr->car = cons_free_list; |
| 512 cons_free_list = ptr; | 512 cons_free_list = ptr; |
| 513 } | 513 } |
| 514 | 514 |
| 515 DEFUN ("cons", Fcons, Scons, 2, 2, 0, | 515 DEFUN ("cons", Fcons, Scons, 2, 2, 0, |
| 516 "Create a new cons, give it CAR and CDR as components, and return it.") | 516 "Create a new cons, give it CAR and CDR as components, and return it.") |
| 520 register Lisp_Object val; | 520 register Lisp_Object val; |
| 521 | 521 |
| 522 if (cons_free_list) | 522 if (cons_free_list) |
| 523 { | 523 { |
| 524 XSETCONS (val, cons_free_list); | 524 XSETCONS (val, cons_free_list); |
| 525 cons_free_list = (struct Lisp_Cons *) XFASTINT (cons_free_list->car); | 525 cons_free_list = *(struct Lisp_Cons **)&cons_free_list->car; |
| 526 } | 526 } |
| 527 else | 527 else |
| 528 { | 528 { |
| 529 if (cons_block_index == CONS_BLOCK_SIZE) | 529 if (cons_block_index == CONS_BLOCK_SIZE) |
| 530 { | 530 { |
| 706 CHECK_STRING (str, 0); | 706 CHECK_STRING (str, 0); |
| 707 | 707 |
| 708 if (symbol_free_list) | 708 if (symbol_free_list) |
| 709 { | 709 { |
| 710 XSETSYMBOL (val, symbol_free_list); | 710 XSETSYMBOL (val, symbol_free_list); |
| 711 symbol_free_list | 711 symbol_free_list = *(struct Lisp_Symbol **)&symbol_free_list->value; |
| 712 = (struct Lisp_Symbol *) XFASTINT (symbol_free_list->value); | |
| 713 } | 712 } |
| 714 else | 713 else |
| 715 { | 714 { |
| 716 if (symbol_block_index == SYMBOL_BLOCK_SIZE) | 715 if (symbol_block_index == SYMBOL_BLOCK_SIZE) |
| 717 { | 716 { |
| 1786 { | 1785 { |
| 1787 register int i; | 1786 register int i; |
| 1788 for (i = 0; i < lim; i++) | 1787 for (i = 0; i < lim; i++) |
| 1789 if (!XMARKBIT (cblk->conses[i].car)) | 1788 if (!XMARKBIT (cblk->conses[i].car)) |
| 1790 { | 1789 { |
| 1791 XSETFASTINT (cblk->conses[i].car, (EMACS_INT) cons_free_list); | |
| 1792 num_free++; | 1790 num_free++; |
| 1791 *(struct Lisp_Cons **)&cblk->conses[i].car = cons_free_list; | |
| 1793 cons_free_list = &cblk->conses[i]; | 1792 cons_free_list = &cblk->conses[i]; |
| 1794 } | 1793 } |
| 1795 else | 1794 else |
| 1796 { | 1795 { |
| 1797 num_used++; | 1796 num_used++; |
| 1816 { | 1815 { |
| 1817 register int i; | 1816 register int i; |
| 1818 for (i = 0; i < lim; i++) | 1817 for (i = 0; i < lim; i++) |
| 1819 if (!XMARKBIT (fblk->floats[i].type)) | 1818 if (!XMARKBIT (fblk->floats[i].type)) |
| 1820 { | 1819 { |
| 1821 XSETFASTINT (fblk->floats[i].type, (EMACS_INT) float_free_list); | |
| 1822 num_free++; | 1820 num_free++; |
| 1821 *(struct Lisp_Float **)&fblk->floats[i].type = float_free_list; | |
| 1823 float_free_list = &fblk->floats[i]; | 1822 float_free_list = &fblk->floats[i]; |
| 1824 } | 1823 } |
| 1825 else | 1824 else |
| 1826 { | 1825 { |
| 1827 num_used++; | 1826 num_used++; |
| 1880 { | 1879 { |
| 1881 register int i; | 1880 register int i; |
| 1882 for (i = 0; i < lim; i++) | 1881 for (i = 0; i < lim; i++) |
| 1883 if (!XMARKBIT (sblk->symbols[i].plist)) | 1882 if (!XMARKBIT (sblk->symbols[i].plist)) |
| 1884 { | 1883 { |
| 1885 XSETFASTINT (sblk->symbols[i].value, (EMACS_INT) symbol_free_list); | 1884 *(struct Lisp_Symbol **)&sblk->symbols[i].value = symbol_free_list; |
| 1886 symbol_free_list = &sblk->symbols[i]; | 1885 symbol_free_list = &sblk->symbols[i]; |
| 1887 num_free++; | 1886 num_free++; |
| 1888 } | 1887 } |
| 1889 else | 1888 else |
| 1890 { | 1889 { |
