some small fixes
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#define MIN_COUNT 10000
|
||||
|
||||
/*
|
||||
* Usage: pipe dblp.xml to the programm or have it in the same folder as the program
|
||||
* Usage: pipe dblp.xml to the program or have it in the same folder as the program
|
||||
*/
|
||||
|
||||
void string_ncopy(char *dest, const char *src, size_t max_len) {
|
||||
@@ -27,10 +27,12 @@ typedef struct person {
|
||||
int count;
|
||||
} person;
|
||||
|
||||
void newPerson(person *p, const char *name) {
|
||||
person* newPerson(const char *name) {
|
||||
person *p = (person *) malloc(sizeof(person));
|
||||
string_ncopy(p->name, name, BUFFER_LENGTH);
|
||||
p->count = 1;
|
||||
p->next = NULL;
|
||||
return p;
|
||||
}
|
||||
|
||||
void sorted_name_insert(person **head, char *name) {
|
||||
@@ -43,8 +45,7 @@ void sorted_name_insert(person **head, char *name) {
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
person *node = (person *) malloc(sizeof(person));
|
||||
newPerson(node, name);
|
||||
person *node = newPerson(name);
|
||||
|
||||
if (*head == NULL || strcmp((*head)->name, name) > 0) {
|
||||
node->next = *head;
|
||||
|
Reference in New Issue
Block a user