Skip to content

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

Open
Palezehvat wants to merge 1 commit into
mainfrom
offsetSecondTask
Open

Palezehvat wants to merge 1 commit into
mainfrom
offsetSecondTask

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

No description provided.

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

Copy link
Copy Markdown

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);

Copy link
Copy Markdown

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,

Copy link
Copy Markdown

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);

Copy link
Copy Markdown

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;

Copy link
Copy Markdown

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;

Copy link
Copy Markdown

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;

Copy link
Copy Markdown

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