-
Notifications
You must be signed in to change notification settings - Fork 0
лексем комментариев #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| { | ||
| *len = 0; | ||
| size_t capacity = 1; | ||
| char *s = (char *)malloc(sizeof(char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У Вас в параметрах функций * пишется с пробелом, при объявлении локальных переменных — нет, а лучше бы единообразно (правильнее * писать слитно с именем переменной, чтобы не путать читателя относительно того, кто именно указатель).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А ещё s как имя переменной — не очень
| char *copy = (char *)malloc(len * sizeof(char)); | ||
| if (copy != NULL) | ||
| { | ||
| strcpy(copy, string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len должна быть на 1 больше strlen, чтобы ещё нулевой байт вместить
| char *getString(size_t * const len, FILE * file, char const endOfLine); | ||
| char *copyString(char const * const string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо комментарии
| #pragma once | ||
|
|
||
| #include <stdbool.h> | ||
| #include <string.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю, что этот файл в хедере не нужен
| { | ||
| return firstStar; | ||
| } | ||
| return start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не-а. //* текст */ тоже комментарий, просто первая / не является его частью
|
|
||
| default: | ||
| return start; | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break не нужен, до него никогда управление не дойдёт
|
|
||
| ErrorCode addComment(List *list, size_t start, size_t end, const char *const text) | ||
| { | ||
| char *string = malloc((start + end + 1) * sizeof(char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start + end, не end - start?
|
|
||
| #define FILENAME "../file.txt" | ||
|
|
||
| typedef enum exitCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| typedef enum exitCode | |
| typedef enum ExitCode |
|
|
||
| if (len != answersSize) | ||
| { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо ещё удалить comments
| return false; | ||
| } | ||
| } | ||
| free(comments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут и выше надо удалить ещё и строки массива — массив ведь представляет собой массив указателей на строки, которые тоже выделены на куче
| } | ||
| return start; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лишний пробел тут и ниже
| { | ||
| return firstStar; | ||
| } | ||
| return start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//*
| size_t i = 0; | ||
| for (Node *node = list->head; node != NULL; node = node->next) | ||
| { | ||
| output[i] = node->value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
переименовать функцию в convertToArray и внутри удалять список
указатель на value занулять
| { | ||
| Node *temp = currentNode; | ||
| currentNode = currentNode->next; | ||
| // free(temp->value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
раскомментировать
| return calloc(1, sizeof(List)); | ||
| } | ||
|
|
||
| ErrorCode addElement(List *list, char *const value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* const в .h тоже
|
|
||
| if (len != answersSize) | ||
| { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
память чистить в любом случае
| free(comments); | ||
| return false; | ||
| } | ||
| } | ||
| free(comments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
строки тоже удалять
No description provided.