Conversation
This reverts commit d28ad94.
|
|
||
| // ��������� ����������� ����� � ���������� ������ | ||
| struct stack_list { | ||
| struct stack_list* prev; // ��������� �� ���������� ���������� � ������ |
There was a problem hiding this comment.
Комментарии в GitHub не отображаются из-за кодировки, возможно в них есть ответ на мой вопрос. Почему решили сделать двусявзный список?
| return -1; | ||
| // �������� ������ ��� ����� ���������� ����� | ||
| struct stack_list* new_root = (struct stack_list*)malloc(sizeof(struct stack_list)); | ||
| if (new_root) { |
There was a problem hiding this comment.
С точки зрения читаемости проще было бы сделать early return
| struct stack_list* new_root = (struct stack_list*)malloc(sizeof(struct stack_list)); | ||
| if (new_root) { | ||
| // ������������� ��������� ���������� ��� ������ ���������� ����������� | ||
| struct stack_list* temp; |
There was a problem hiding this comment.
Неинициализированный указатель. Можно было бы сразу struct stack_list* temp = &list_root;
| // ������� ���������� ���������� ����� � ���������� ������ | ||
| struct stack_list* temp; | ||
| temp = &list_root; | ||
| temp = temp->next; |
There was a problem hiding this comment.
Эти три строки можно было записать так:
struct stack_list* temp = list_root.next;| temp = temp->next; | ||
| // ���� ����� ���� � �������� ������������, �������� ��� �������� | ||
| if (hstack == temp->descriptor) { | ||
| valid_handler = 0; |
There was a problem hiding this comment.
Наверное тут нужен break
| stack_r->prev = new_node; | ||
|
|
||
| // �������� ������ � ����� ������� | ||
| if (new_node->data) { |
There was a problem hiding this comment.
Результат malloc проверяется поздно, надо бы сразу после вызова делать проверку. Причем если она на прошла, new_node надо удалять, иначе будет утечка памяти
| } | ||
|
|
||
| // ���������, ��� ����� ������������ ������� � �� NULL | ||
| if (stack_r->size <= size && data_out != NULL) { |
There was a problem hiding this comment.
Проверку data_out лучше делать в начале функции
No description provided.