Skip to content

Commit 21121a5

Browse files
committed
Rename all identifiers with 2 underscores at the beginning
1 parent e30dd73 commit 21121a5

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

include/binary_search_tree.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace alg {
5757
BST():m_root(NULL){};
5858

5959
~BST() {
60-
__destruct(m_root);
60+
destruct_(m_root);
6161
}
6262

6363
/**
@@ -159,10 +159,10 @@ namespace alg {
159159
}
160160

161161
private:
162-
void __destruct(treeNode *n) {
162+
void destruct_(treeNode *n) {
163163
if (n==NULL) return;
164-
__destruct(n->left);
165-
__destruct(n->right);
164+
destruct_(n->left);
165+
destruct_(n->right);
166166
delete n;
167167
}
168168

include/double_linked_list.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct list_head {
3939
* the prev/next entries already!
4040
*/
4141
static inline void
42-
__list_add(struct list_head *n,
42+
list_add_(struct list_head *n,
4343
struct list_head *prev,
4444
struct list_head *next)
4545
{
@@ -57,14 +57,14 @@ __list_add(struct list_head *n,
5757
* the prev/next entries already!
5858
*/
5959
static inline void
60-
__list_del(struct list_head *prev, struct list_head *next)
60+
list_del_(struct list_head *prev, struct list_head *next)
6161
{
6262
next->prev = prev;
6363
prev->next = next;
6464
}
6565

6666
static inline void
67-
__list_splice(struct list_head *list, struct list_head *head)
67+
list_splice_(struct list_head *list, struct list_head *head)
6868
{
6969
struct list_head *first = list->next;
7070
struct list_head *last = list->prev;
@@ -88,7 +88,7 @@ __list_splice(struct list_head *list, struct list_head *head)
8888
static inline void
8989
list_add(struct list_head *n, struct list_head *head)
9090
{
91-
__list_add(n, head, head->next);
91+
list_add_(n, head, head->next);
9292
}
9393

9494
/**
@@ -102,7 +102,7 @@ list_add(struct list_head *n, struct list_head *head)
102102
static inline void
103103
list_add_tail(struct list_head *n, struct list_head *head)
104104
{
105-
__list_add(n, head->prev, head);
105+
list_add_(n, head->prev, head);
106106
}
107107

108108
/**
@@ -113,7 +113,7 @@ list_add_tail(struct list_head *n, struct list_head *head)
113113
static inline void
114114
list_del(struct list_head *entry)
115115
{
116-
__list_del(entry->prev, entry->next);
116+
list_del_(entry->prev, entry->next);
117117
entry->next = NULL;
118118
entry->prev = NULL;
119119
}
@@ -125,7 +125,7 @@ list_del(struct list_head *entry)
125125
static inline void
126126
list_del_init(struct list_head *entry)
127127
{
128-
__list_del(entry->prev, entry->next);
128+
list_del_(entry->prev, entry->next);
129129
INIT_LIST_HEAD(entry);
130130
}
131131

@@ -137,7 +137,7 @@ list_del_init(struct list_head *entry)
137137
static inline void
138138
list_move(struct list_head *list, struct list_head *head)
139139
{
140-
__list_del(list->prev, list->next);
140+
list_del_(list->prev, list->next);
141141
list_add(list, head);
142142
}
143143

@@ -149,7 +149,7 @@ list_move(struct list_head *list, struct list_head *head)
149149
static inline void
150150
list_move_tail(struct list_head *list, struct list_head *head)
151151
{
152-
__list_del(list->prev, list->next);
152+
list_del_(list->prev, list->next);
153153
list_add_tail(list, head);
154154
}
155155

@@ -172,7 +172,7 @@ static inline void
172172
list_splice(struct list_head *list, struct list_head *head)
173173
{
174174
if (!list_empty(list))
175-
__list_splice(list, head);
175+
list_splice_(list, head);
176176
}
177177

178178
/**
@@ -186,7 +186,7 @@ static inline void list_splice_init(struct list_head *list,
186186
struct list_head *head)
187187
{
188188
if (!list_empty(list)) {
189-
__list_splice(list, head);
189+
list_splice_(list, head);
190190
INIT_LIST_HEAD(list);
191191
}
192192
}

include/merge_sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace alg {
4040
* Merge functions merges the two sorted parts. Sorted parts will be from [left, mid] and [mid+1, right].
4141
*/
4242
template<typename T>
43-
static void __merge(T *array, int left, int mid, int right) {
43+
static void merge_(T *array, int left, int mid, int right) {
4444
/*We need a Temporary array to store the new sorted part*/
4545
T tempArray[right-left+1];
4646
int pos=0,lpos = left,rpos = mid + 1;
@@ -75,7 +75,7 @@ namespace alg {
7575
/* Sort the right part */
7676
merge_sort(array,mid+1,right);
7777
/* Merge the two sorted parts */
78-
__merge(array,left,mid,right);
78+
merge_(array,left,mid,right);
7979
}
8080
}
8181

include/quick_sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace alg {
2525
* the quick-sort partition routine
2626
*/
2727
template<typename T>
28-
static int __partition(T list[],int begin, int end) {
28+
static int partition_(T list[],int begin, int end) {
2929
int pivot_idx = RANDOM(begin,end);
3030
T pivot = list[pivot_idx];
3131
swap(list[begin], list[pivot_idx]);
@@ -52,7 +52,7 @@ namespace alg {
5252
template<typename T>
5353
static void quicksort(T list[],int begin,int end) {
5454
if( begin < end) {
55-
int pivot_idx = __partition<T>(list, begin, end);
55+
int pivot_idx = partition_<T>(list, begin, end);
5656
quicksort(list, begin, pivot_idx-1);
5757
quicksort(list, pivot_idx+1, end);
5858
}

include/radix_sort.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace alg {
2929
/**
3030
* couting sort
3131
*/
32-
static void __radix(int byte, const unsigned N, const uint32_t *source, uint32_t *dest) {
32+
static void radix_(int byte, const unsigned N, const uint32_t *source, uint32_t *dest) {
3333
unsigned count[256];
3434
unsigned index[256];
3535
memset(count, 0, sizeof (count));
@@ -51,10 +51,10 @@ namespace alg {
5151
*/
5252
static void radix_sort(uint32_t *source, const unsigned N) {
5353
uint32_t * temp = new uint32_t[N];
54-
__radix(0, N, source, temp);
55-
__radix(1, N, temp, source);
56-
__radix(2, N, source, temp);
57-
__radix(3, N, temp, source);
54+
radix_(0, N, source, temp);
55+
radix_(1, N, temp, source);
56+
radix_(2, N, source, temp);
57+
radix_(3, N, temp, source);
5858

5959
delete [] temp;
6060
}

include/random_select.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace alg {
2727
* the random_select partition routine
2828
*/
2929
template<typename T>
30-
static int __partition(T list[],int begin, int end) {
30+
static int partition_(T list[],int begin, int end) {
3131
int pivot_idx = RANDOM(begin,end);
3232
T pivot = list[pivot_idx];
3333
swap(list[begin],list[pivot_idx]);
@@ -56,7 +56,7 @@ namespace alg {
5656
if(begin == end)
5757
return begin;
5858

59-
int pivot_idx = __partition<T>(list, begin, end);
59+
int pivot_idx = partition_<T>(list, begin, end);
6060
int human_idx = pivot_idx - begin + 1;
6161

6262
if(k < human_idx)

src/lcs_demo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#define printlistC(list,n) \
88
do { \
9-
int __list_counter; \
10-
for(__list_counter=0;__list_counter<n;__list_counter++) \
11-
printf("%c\t ",list[__list_counter]); \
9+
int list_counter_; \
10+
for(list_counter_=0;list_counter_<n;list_counter_++) \
11+
printf("%c\t ",list[list_counter_]); \
1212
printf("\n"); \
1313
} while(0)
1414

0 commit comments

Comments
 (0)