diff options
Diffstat (limited to 'toxcore/misc_tools.h')
-rw-r--r-- | toxcore/misc_tools.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/misc_tools.h b/toxcore/misc_tools.h index 5fd0cb7a..4bf28ac7 100644 --- a/toxcore/misc_tools.h +++ b/toxcore/misc_tools.h | |||
@@ -89,7 +89,7 @@ int main() | |||
89 | { | 89 | { |
90 | tox_list_t head; | 90 | tox_list_t head; |
91 | tox_list_new(&head); //initialize head | 91 | tox_list_new(&head); //initialize head |
92 | 92 | ||
93 | //input a new character, until user enters q or e | 93 | //input a new character, until user enters q or e |
94 | char c = '\0'; | 94 | char c = '\0'; |
95 | while (c != 'q' && c != 'e') { | 95 | while (c != 'q' && c != 'e') { |
@@ -98,16 +98,16 @@ int main() | |||
98 | tmp->c = c; | 98 | tmp->c = c; |
99 | tox_list_add(&head, &tmp->tox_lst); //add it to the list | 99 | tox_list_add(&head, &tmp->tox_lst); //add it to the list |
100 | } | 100 | } |
101 | 101 | ||
102 | TOX_LIST_FOR_EACH() takes a struct tox_list and a name for a temporary pointer to use in the loop. | 102 | TOX_LIST_FOR_EACH() takes a struct tox_list and a name for a temporary pointer to use in the loop. |
103 | 103 | ||
104 | TOX_LIST_GET_VALUE() uses magic to return an instance of a structure that contains tox_list_t. | 104 | TOX_LIST_GET_VALUE() uses magic to return an instance of a structure that contains tox_list_t. |
105 | You have to give it a temporary tox_string_t, name of tox_list_t member inside our structure (tox_lst), | 105 | You have to give it a temporary tox_string_t, name of tox_list_t member inside our structure (tox_lst), |
106 | and the type of structure to return. | 106 | and the type of structure to return. |
107 | 107 | ||
108 | TOX_LIST_FOR_EACH(head, tmp) | 108 | TOX_LIST_FOR_EACH(head, tmp) |
109 | printf("%c", TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c); | 109 | printf("%c", TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c); |
110 | 110 | ||
111 | TOX_LIST_FOR_EACH(head, tmp) { | 111 | TOX_LIST_FOR_EACH(head, tmp) { |
112 | if (TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c == 'z') { | 112 | if (TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c == 'z') { |
113 | //If you delete tmp, you have to quit the loop, or it will go on infinitly. | 113 | //If you delete tmp, you have to quit the loop, or it will go on infinitly. |
@@ -116,12 +116,12 @@ and the type of structure to return. | |||
116 | break; | 116 | break; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | printf("\n"); | 120 | printf("\n"); |
121 | TOX_LIST_FOR_EACH(head, tmp) | 121 | TOX_LIST_FOR_EACH(head, tmp) |
122 | printf("%c", TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c); | 122 | printf("%c", TOX_LIST_GET_VALUE(*tmp, tox_lst, tox_string_t).c); |
123 | 123 | ||
124 | 124 | ||
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | */ | 127 | */ |