gbranden pushed a commit to branch master in repository groff. commit f078d60b9e76817e4c36ce4788010bb0bfc195ed Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Fri Aug 27 18:13:32 2021 +1000
[libgroff]: Drop `ad_delete` preprocessor wrapper. ...for the `delete` operator. It has been rendered unnecessary by the removal of support for ancient C++ compilers. * src/include/lib.h (ad_delete): Drop symbol definition. * src/preproc/pic/object.cpp (graphic_object::print_text): * src/preproc/refer/ref.cpp (reference::reference, reference::merge, reference::insert_field, reference::delete_field): * src/preproc/tbl/main.cpp (format::add_rows): Port uses of `ad_delete(xxx)` to `delete[]`. --- ChangeLog | 15 +++++++++++++++ src/include/lib.h | 4 +--- src/preproc/pic/object.cpp | 2 +- src/preproc/refer/ref.cpp | 10 +++++----- src/preproc/tbl/main.cpp | 4 ++-- src/preproc/tbl/table.cpp | 2 +- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5d95b1..144b059 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2021-08-27 G. Branden Robinson <g.branden.robin...@gmail.com> + + [libgroff]: Drop `ad_delete` preprocessor wrapper for the + `delete` operator. It has been rendered unnecessary by the + removal of support for ancient C++ compilers. + + * src/include/lib.h (ad_delete): Drop symbol definition. + + * src/preproc/pic/object.cpp (graphic_object::print_text): + * src/preproc/refer/ref.cpp (reference::reference, + reference::merge, reference::insert_field, + reference::delete_field): + * src/preproc/tbl/main.cpp (format::add_rows): Port uses of + `ad_delete(xxx)` to `delete[]`. + 2021-08-28 G. Branden Robinson <g.branden.robin...@gmail.com> * m4/groff.m4 (GROFF_ARRAY_DELETE): Update `AC_MSG_CHECKING` diff --git a/src/include/lib.h b/src/include/lib.h index 6b2613e..4b8edfa 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -132,7 +132,5 @@ extern "C" { int strncasecmp(const char *, const char *, size_t); } const double PI = 3.14159265358979323846; -/* ad_delete deletes an array of objects with destructors; - a_delete deletes an array of objects without destructors */ -#define ad_delete(size) delete [] +/* a_delete deletes an array of objects without destructors */ #define a_delete delete [] diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp index ce0a7da..291fbcb 100644 --- a/src/preproc/pic/object.cpp +++ b/src/preproc/pic/object.cpp @@ -669,7 +669,7 @@ void graphic_object::print_text() graphic_object::~graphic_object() { if (text) - ad_delete(ntext) text; + delete[] text; } class rectangle_object : public graphic_object { diff --git a/src/preproc/refer/ref.cpp b/src/preproc/refer/ref.cpp index c97e0b0..9e1b5e7 100644 --- a/src/preproc/refer/ref.cpp +++ b/src/preproc/refer/ref.cpp @@ -152,7 +152,7 @@ reference::reference(const char *start, int len, reference_id *ridp) reference::~reference() { if (nfields > 0) - ad_delete(nfields) field; + delete[] field; } // ref is the inline, this is the database ref @@ -175,7 +175,7 @@ void reference::merge(reference &ref) nfields++; if (nfields != old_nfields) { if (old_nfields > 0) - ad_delete(old_nfields) field; + delete[] field; field = new string[nfields]; } int j = 0; @@ -209,7 +209,7 @@ void reference::insert_field(unsigned char c, string &s) for (i = pos; i < nfields; i++) field[i + 1].move(old_field[i]); if (nfields > 0) - ad_delete(nfields) old_field; + delete[] old_field; nfields++; field_index[c] = pos; for (i = c + 1; i < 256; i++) @@ -229,14 +229,14 @@ void reference::delete_field(unsigned char c) for (i = field_index[c]; i < nfields - 1; i++) field[i].move(old_field[i + 1]); if (nfields > 0) - ad_delete(nfields) old_field; + delete[] old_field; nfields--; field_index[c] = NULL_FIELD_INDEX; for (i = c + 1; i < 256; i++) if (field_index[i] != NULL_FIELD_INDEX) field_index[i] -= 1; } - + void reference::compute_hash_code() { if (!rid.is_null()) diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp index 710587b..59c92ed 100644 --- a/src/preproc/tbl/main.cpp +++ b/src/preproc/tbl/main.cpp @@ -683,12 +683,12 @@ void format::add_rows(int n) format::~format() { a_delete separation; - ad_delete(ncolumns) width; + delete[] width; a_delete equal; a_delete expand; for (int i = 0; i < nrows; i++) { a_delete vline[i]; - ad_delete(ncolumns) entry[i]; + delete[] entry[i]; } a_delete vline; a_delete entry; diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp index 60b61b9..e3a1133 100644 --- a/src/preproc/tbl/table.cpp +++ b/src/preproc/tbl/table.cpp @@ -1272,7 +1272,7 @@ table::~table() entry_list = entry_list->next; delete tem; } - ad_delete(ncolumns) minimum_width; + delete[] minimum_width; a_delete column_separation; a_delete equal; a_delete expand; _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit