Skip to content

Comments

Вторая задача зачёта#23

Open
Palezehvat wants to merge 1 commit intomainfrom
offsetSecondTask
Open

Вторая задача зачёта#23
Palezehvat wants to merge 1 commit intomainfrom
offsetSecondTask

Conversation

@Palezehvat
Copy link
Owner

No description provided.

NodeList* walker = list->head;
while (walker->next != NULL) {
walker = walker->next;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Получается, что добавление всегда только в конец и всегда за линию. Я бы как пользователь ожидал реализации за константу --- за линию можно и в произвольное место добавлять.

Comment on lines +103 to +104
char* value = list->head->value;
free(list->head);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Но поскольку value живёт внутри структуры NodeList, то free удалит и value. Так что тут мы возвращаем уже мёртвый указатель. Это всё не падает, видимо, просто потом, что возвращаемое значение на самом деле никому не интересно.

typedef struct List List;

typedef enum Error {
memoryError,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А тут внезапно отступы табами

ok,
}Error;

List* createList(Error* errorCheck);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо комментарии

List* list = createList(errorCheck);
if (list == NULL) {
*errorCheck = emptyPointer;
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Файл не закрыт окажется

}
List* list = createList(&errorCheck);
if (list == NULL) {
errorCheck = emptyPointer;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну и тут файл не закрыт.

return false;
}
clearList(list, &errorCheck);
return result;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И копипаст с main-ом

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants