Skip to content

Conversation

@kamendov-maxim
Copy link
Owner

No description provided.

@@ -0,0 +1,48 @@
#include <stdlib.h>

Choose a reason for hiding this comment

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

Общие замечания:

  • Комментарии к коммитам ужасны
  • Надо проектные файлы. Тут вообще исходники раскиданы по папкам, собирать вручную — очень такое себе развлечение.

Comment on lines +39 to +48
char *copyString(char const * const string)
{
const size_t len = strlen(string);
char *copy = (char *)malloc(len * sizeof(char));
if (copy != NULL)
{
strcpy(copy, string);
}
return copy;
}

Choose a reason for hiding this comment

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

Есть strdup

#include <string.h>
#include <stdio.h>

char *getString(size_t * const len, FILE * file, char const endOfLine);

Choose a reason for hiding this comment

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

Надо комментарии к функциям из заголовочного файла

Comment on lines +39 to +55
switch (edge->firstNodeNumber == 0)
{
case false:
{
edge->firstNodeNumber = nodeNumber;
break;
}

case true:
{
edge->secondNodeNumber = nodeNumber;
break;
}

default:
break;
}

Choose a reason for hiding this comment

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

Лол.

Suggested change
switch (edge->firstNodeNumber == 0)
{
case false:
{
edge->firstNodeNumber = nodeNumber;
break;
}
case true:
{
edge->secondNodeNumber = nodeNumber;
break;
}
default:
break;
}
if (edge->firstNodeNumber == 0)
{
edge->secondNodeNumber = nodeNumber;
}
else
{
edge->firstNodeNumber = nodeNumber;
}

А то default для булевого выражения выглядит очень мило, особенно с break, который ничего не делает.

List ** componentsTable = createComponentsTable;
if (componentsTable == NULL)
{

Choose a reason for hiding this comment

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

Лишняя пустая строчка

return memoryErrorFile;
}


Choose a reason for hiding this comment

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

Две пустые строки подряд --- нехорошо


void printComponentsTable(Graph *graph, const size_t nodeAmount)
{
List ** componentsTable = createComponentsTable;

Choose a reason for hiding this comment

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

Это не скомпилится, аргументы не передаются :)

Graph *createGraph(const size_t nodeAmount, const size_t edgeAmount);
void connectNode(Graph *graph, size_t index, size_t nodeNumber);
void printComponentsTable(Graph *graph, const size_t nodeAmount);
void deleteGraph(Graph * const graph);

Choose a reason for hiding this comment

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

Лучше так:

Suggested change
void deleteGraph(Graph * const graph);
void deleteGraph(Graph ** const graph);

Чтобы потом иметь возможность присвоить NULL в graph и не оставлять у вызывающего указатель на удалённую область памяти.

int getValueByIndex(List *list, size_t index, ListErrorCode *listErrorCode);

//checks if value is already in the list
const bool checkValue(List *list, int value)

Choose a reason for hiding this comment

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

Не компилится, тут точки с запятой не хватает. Причём тут дело даже не в различиях между компиляторами, так и в gcc, и в Visual Studio, и везде компилироваться не будет


ListErrorCode append(List *const list, int const value)
{
Node **currentNode = list->head;

Choose a reason for hiding this comment

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

Это тоже вызывает ругань компилятора, list->head имеет тип Node*, а мы его присваиваем в Node **. Типы не сходятся.

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.

2 participants