Changeset 8243cf9
- Timestamp:
- Apr 27, 2016, 4:54:34 PM (9 years ago)
- Branches:
- string
- Children:
- 9ea58ca
- Parents:
- 7ea1b3a
- Location:
- src/examples/strings
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/strings/src/internal/VbyteSM.c
r7ea1b3a r8243cf9 1 1 #include "VbyteSM.h" 2 #include "tools.h" 3 4 void AddThisAfter(HandleNode_t* const this, HandleNode_t* n) 5 { 6 this->next = n->next; 7 this->previous = n; 8 HandleNode_t* n_next = n->next; 9 n_next->previous = this; 10 n->next = this; 11 } 12 13 void DeleteNode(HandleNode_t* const this) 14 { 15 HandleNode_t* next = this->next; 16 HandleNode_t* prev = this->previous; 17 18 next->previous = prev; 19 prev->next = next; 20 } 21 22 void MoveThisAfter(HandleNode_t* const this, const HandleNode_t* rhs) 23 { 24 assertf( this->string < rhs->string, 25 "VbyteSM: Error - Cannot move byte string starting at: %lX after byte string starting at: %lX and keep handles in ascending order", 26 (unsigned long int)this->string, 27 (unsigned long int)rhs->string); 28 29 HandleNode_t* i; 30 for(i = rhs->next; 31 i->string && this->string > i->string; 32 i = i->next ); 33 34 if( this != i->previous ) 35 { 36 DeleteNode(this); 37 AddThisAfter(this, i->previous); 38 } 39 } -
src/examples/strings/src/internal/VbyteSM.h
r7ea1b3a r8243cf9 1 1 #pragma once 2 3 #include <stdlib> 2 4 3 5 typedef char char_t; … … 14 16 HandleNode_t* previous; 15 17 }; 16 17 static inline void ctor(HandleNode_t* const this);18 static inline void ctor(HandleNode_t* const this, VbyteHeap_t* heap);19 static inline void dtor(HandleNode_t* const this);20 18 21 19 void DeleteNode(HandleNode_t* const this); … … 40 38 HandleNode_t Header; 41 39 }; 42 43 static inline void ctor(VbyteHeap* const this, int size);44 static inline void dtor(VbyteHeap* const this);45 40 46 41 void compaction(VbyteHeap* const this); … … 84 79 this->ExtVbyte = (void*)( this->StartVbyte + this->CurrSize ); 85 80 86 ctor( &this->Header);81 ctor((HandleNode_t* const)&this->Header); 87 82 this->Header.next = &this->Header; 88 83 this->Header.previous = &this->Header;
Note: See TracChangeset
for help on using the changeset viewer.