aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-04-07 18:54:40 -0700
committerPaul Eggert2017-04-07 18:54:40 -0700
commita2b3fea957440b8358d3632a4a05e41dee964b5d (patch)
treea6ef4cf0ba807dfad9ae91b4bfde1935dc999a5f /src
parenta614cd416c5dd71702428a008992589395a722fc (diff)
downloademacs-a2b3fea957440b8358d3632a4a05e41dee964b5d.tar.gz
emacs-a2b3fea957440b8358d3632a4a05e41dee964b5d.zip
Deprecate copy-record in favor of copy-sequence
Since copy-sequence seems to be needed anyway for records, have it work on records, and remove copy-record as being superfluous. * doc/lispref/records.texi (Records, Record Functions): * lisp/emacs-lisp/cl-macs.el (cl-defstruct): * lisp/emacs-lisp/eieio.el (make-instance, clone): * test/src/alloc-tests.el (record-3): Use copy-sequence, not copy-record, to copy records. * doc/lispref/sequences.texi (Sequence Functions) (Array Functions): Document that aref and copy-sequence work on records. * etc/NEWS: Omit copy-record. * src/alloc.c (Fcopy_record): Remove. * src/data.c (Faref): Document that arg can be a record. * src/fns.c (Fcopy_sequence): Copy records, too.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c14
-rw-r--r--src/data.c4
-rw-r--r--src/fns.c12
3 files changed, 11 insertions, 19 deletions
diff --git a/src/alloc.c b/src/alloc.c
index fad84b8a0b3..88a1a1ed660 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3440,19 +3440,6 @@ usage: (record TYPE &rest SLOTS) */)
3440} 3440}
3441 3441
3442 3442
3443DEFUN ("copy-record", Fcopy_record, Scopy_record, 1, 1, 0,
3444 doc: /* Return a new record that is a shallow copy of the argument RECORD. */)
3445 (Lisp_Object record)
3446{
3447 CHECK_RECORD (record);
3448 ptrdiff_t size = ASIZE (record) & PSEUDOVECTOR_SIZE_MASK;
3449 struct Lisp_Vector *new = allocate_record (size);
3450 memcpy (new->contents, XVECTOR (record)->contents,
3451 size * sizeof (Lisp_Object));
3452 return make_lisp_ptr (new, Lisp_Vectorlike);
3453}
3454
3455
3456DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, 3443DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
3457 doc: /* Return a newly created vector of length LENGTH, with each element being INIT. 3444 doc: /* Return a newly created vector of length LENGTH, with each element being INIT.
3458See also the function `vector'. */) 3445See also the function `vector'. */)
@@ -7523,7 +7510,6 @@ The time is in seconds as a floating point value. */);
7523 defsubr (&Slist); 7510 defsubr (&Slist);
7524 defsubr (&Svector); 7511 defsubr (&Svector);
7525 defsubr (&Srecord); 7512 defsubr (&Srecord);
7526 defsubr (&Scopy_record);
7527 defsubr (&Sbool_vector); 7513 defsubr (&Sbool_vector);
7528 defsubr (&Smake_byte_code); 7514 defsubr (&Smake_byte_code);
7529 defsubr (&Smake_list); 7515 defsubr (&Smake_list);
diff --git a/src/data.c b/src/data.c
index 3ffca54658d..903e809d235 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2266,8 +2266,8 @@ function chain of symbols. */)
2266/* Extract and set vector and string elements. */ 2266/* Extract and set vector and string elements. */
2267 2267
2268DEFUN ("aref", Faref, Saref, 2, 2, 0, 2268DEFUN ("aref", Faref, Saref, 2, 2, 0,
2269 doc: /* Return the element of ARRAY at index IDX. 2269 doc: /* Return the element of ARG at index IDX.
2270ARRAY may be a vector, a string, a char-table, a bool-vector, 2270ARG may be a vector, a string, a char-table, a bool-vector, a record,
2271or a byte-code object. IDX starts at 0. */) 2271or a byte-code object. IDX starts at 0. */)
2272 (register Lisp_Object array, Lisp_Object idx) 2272 (register Lisp_Object array, Lisp_Object idx)
2273{ 2273{
diff --git a/src/fns.c b/src/fns.c
index 47da5f8b4bc..2f07c2ccfb7 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -475,13 +475,19 @@ usage: (vconcat &rest SEQUENCES) */)
475 475
476 476
477DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0, 477DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0,
478 doc: /* Return a copy of a list, vector, string or char-table. 478 doc: /* Return a copy of a list, vector, string, char-table or record.
479The elements of a list or vector are not copied; they are shared 479The elements of a list, vector or record are not copied; they are
480with the original. */) 480shared with the original. */)
481 (Lisp_Object arg) 481 (Lisp_Object arg)
482{ 482{
483 if (NILP (arg)) return arg; 483 if (NILP (arg)) return arg;
484 484
485 if (RECORDP (arg))
486 {
487 ptrdiff_t size = ASIZE (arg) & PSEUDOVECTOR_SIZE_MASK;
488 return Frecord (size, XVECTOR (arg)->contents);
489 }
490
485 if (CHAR_TABLE_P (arg)) 491 if (CHAR_TABLE_P (arg))
486 { 492 {
487 return copy_char_table (arg); 493 return copy_char_table (arg);