Hosted by the courtesy of GitHub |
The stars ASAP
Durée du voyage intersidéral Résolutions de l'ONU en HTML Bussard Ramjet |
DWARF : dwarf2xml
ELF : libelf examples Code presentation : ctoohtml |
Top | Download | Source code |
Home |
The interface let you to add, remove and list nodes in the ring. The most interresting way is to use macros. In order to use them, you have to include in your node structure a member that hold the ring information, for example :struct s_my_ring_node { int an_usefull_integer; short a_counter; s_ring link; // ring stuff struct s_data my_datas[]; };is ready to be use in a ring :static struct s_my_ring_node *my_ring; // don't lose holding pointer ! ... struct s_my_ring_node a_node; ... my_ring = m_ring_link(my_ring, link, &a_node); ...That's it, a_node is now linked in the ring. Remember that rings does not care about memory management.
When the ring is empty, it's holding pointer is null. The link method accept null pointers and add the new node in the ring, linking its reference pointer on it self. A pointer to the new added node is always returned by the link method.
This is also true for the unlink method. The ring must always be hold by the result of theses 2 methods.
Successor and, when possibly ancestor, can be listed with next and previous methods. Linked pieces of memory in the ring must, at least, contain somewhere the suitable structure for the ring type there are in.
There are several, and potentially plenty, possible types of rings. The most simple is a simple pointer ring.
Hosted by the courtesy of GitHub |
The stars ASAP
Durée du voyage intersidéral Résolutions de l'ONU en HTML Bussard Ramjet |
DWARF : dwarf2xml
ELF : libelf examples Code presentation : ctoohtml |