Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: Discourage usage of deprecated data structures #16140

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
extern "C" {
#endif

/*
* NOTICE:
*
* If you are reading this file in an effort to add a new hash structure
* this is the wrong place to be using it. Please see the typesafe
* data structures, or ask one of the other developers.
*
* If you are reading this file as a way to update an existing usage
* of this data structure, please consider just converting the data
* structure to one of the typesafe data structures instead.
*/

/* Default hash table size. */
#define HASH_INITIAL_SIZE 256
/* Expansion threshold */
Expand Down
12 changes: 12 additions & 0 deletions lib/linklist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
extern "C" {
#endif

/*
* NOTICE:
*
* If you are reading this file in an effort to add a new list structure
* this is the wrong place to be using it. Please see the typesafe
* data structures, or ask one of the other developers.
*
* If you are reading this file as a way to update an existing usage
* of this data structure, please consider just converting the data
* structure to one of the typesafe data structures instead.
*/

/* listnodes must always contain data to be valid. Adding an empty node
* to a list is invalid
*/
Expand Down
16 changes: 16 additions & 0 deletions lib/openbsd-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
extern "C" {
#endif

/*
* NOTICE:
*
* If you are reading this file in an effort to add a new queue structure
* this is the wrong place to be using it. Please see the typesafe
* data structures, or ask one of the other developers.
*
* If you are reading this file as a way to update an existing usage
* of this data structure, please consider just converting the data
* structure to one of the typesafe data structures instead. However,
* among converting datastrucutres, the the BSD ones are the lowest
* priority / should be converted last. They are already typesafe and
* use inline linking nodes, so the only gain is consistency. Please
* convert uses of linklist.h and hash.h first.
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the BSD variants (only) could we instead say:

If you are reading this file in an effort to add a new queue/tree
structure, please consider using the FRR native versions found in
lib/typesafe.h as an approved alternative.

/*
* This file defines five types of data structures: singly-linked lists,
* lists, simple queues, tail queues and XOR simple queues.
Expand Down
15 changes: 15 additions & 0 deletions lib/openbsd-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* NOTICE:
*
* If you are reading this file in an effort to add a new tree structure
* this is the wrong place to be using it. Please see the typesafe
* data structures, or ask one of the other developers.
*
* If you are reading this file as a way to update an existing usage
* of this data structure, please consider just converting the data
* structure to one of the typesafe data structures instead. However,
* among converting datastrucutres, the the BSD ones are the lowest
* priority / should be converted last. They are already typesafe and
* use inline linking nodes, so the only gain is consistency. Please
* convert uses of linklist.h and hash.h first.
*/

/*
* This file defines data structures for different types of trees:
Expand Down
Loading