Mercurial > octave
annotate liboctave/util/oct-locbuf.h @ 29358:0a5b15007766 stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 09:52:15 -0500 |
parents | bd51beb6205e |
children | 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
3 // Copyright (C) 2008-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
8377 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_oct_locbuf_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
27 #define octave_oct_locbuf_h 1 |
8377 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
30 |
8377 | 31 #include <cstddef> |
8400
7b6e1fc1cb90
implement obstack-like optimization of local buffers
Jaroslav Hajek <highegg@gmail.com>
parents:
8379
diff
changeset
|
32 |
23775
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
33 #include <algorithm> |
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
34 #include <memory> |
8400
7b6e1fc1cb90
implement obstack-like optimization of local buffers
Jaroslav Hajek <highegg@gmail.com>
parents:
8379
diff
changeset
|
35 |
23775
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
36 #if __cplusplus >= 201402L |
8377 | 37 |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
38 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \ |
23775
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
39 auto octave_local_buffer_ ## buf = std::make_unique<T []> (size); \ |
23776
a0b7a29338d5
Remove assert() accidentally left in cset 7b43a96c2179.
Rik <rik@octave.org>
parents:
23775
diff
changeset
|
40 T *buf = octave_local_buffer_ ## buf.get () |
8377 | 41 |
42 #else | |
43 | |
23775
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
44 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \ |
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
45 std::unique_ptr<T []> octave_local_buffer_ ## buf { new T [size] }; \ |
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
46 T *buf = octave_local_buffer_ ## buf.get () |
8377 | 47 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 #endif |
8377 | 49 |
23775
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
50 #define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \ |
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
51 OCTAVE_LOCAL_BUFFER (T, buf, size); \ |
7b43a96c2179
Replace OCTAVE_LOCAL_BUFFER code with std::unique_ptr (bug #48793).
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
52 std::fill_n (buf, size, value) |
8379
ad8ed668e0a4
allow initialized local buffers
Jaroslav Hajek <highegg@gmail.com>
parents:
8377
diff
changeset
|
53 |
8377 | 54 #endif |