Skip to content
Extraits de code Groupes Projets
Valider 2d59e74e rédigé par Laurent Paucot's avatar Laurent Paucot
Parcourir les fichiers

test

parent 1d3f8f3b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #5562 réussi
...@@ -143,7 +143,6 @@ void enqueue(queue_t* q, unsigned long long val){ ...@@ -143,7 +143,6 @@ void enqueue(queue_t* q, unsigned long long val){
} }
q->size++; q->size++;
//return q; //return q;
//free(ptr->next);
free(ptr); free(ptr);
} }
...@@ -153,7 +152,6 @@ queue_t* prime_divs(unsigned long long number){ ...@@ -153,7 +152,6 @@ queue_t* prime_divs(unsigned long long number){
struct queue new_queue; struct queue new_queue;
new_queue.size = 0; new_queue.size = 0;
new_queue.final = 0;
new_queue.tail = malloc(sizeof(node_t)); new_queue.tail = malloc(sizeof(node_t));
if(new_queue.tail==NULL){return NULL;} if(new_queue.tail==NULL){return NULL;}
...@@ -193,10 +191,8 @@ void *writing(void *param){ ...@@ -193,10 +191,8 @@ void *writing(void *param){
{ {
//printf("final : %d\n",pr_divs->final); //printf("final : %d\n",pr_divs->final);
if (stop == N-1){ if (stop == N-1){
free(pr_divs);
return NULL; return NULL;
} }
free(pr_divs);
stop++; stop++;
} }
else{ else{
...@@ -210,17 +206,15 @@ void *writing(void *param){ ...@@ -210,17 +206,15 @@ void *writing(void *param){
*current = *pr_divs->tail; *current = *pr_divs->tail;
current = current->next; current = current->next;
fprintf(file2,"%llu",current->value); fprintf(file2,"%lld",current->value);
current = current->next; current = current->next;
for (int i = 1; i < pr_divs->size; i++) for (int i = 1; i < pr_divs->size; i++)
{ {
fprintf(file2," %llu",current->value); fprintf(file2," %lld",current->value);
current = current->next; current = current->next;
} }
fputc('\n',file2); fputc('\n',file2);
free(current);
} }
...@@ -257,7 +251,6 @@ void *calculating(void *param){ ...@@ -257,7 +251,6 @@ void *calculating(void *param){
put_in_buffer_2(final,buffer_2); put_in_buffer_2(final,buffer_2);
pthread_mutex_unlock(&mutex2); pthread_mutex_unlock(&mutex2);
sem_post(&full2); sem_post(&full2);
return NULL; return NULL;
} }
...@@ -274,10 +267,6 @@ void *calculating(void *param){ ...@@ -274,10 +267,6 @@ void *calculating(void *param){
pthread_mutex_unlock(&mutex2); pthread_mutex_unlock(&mutex2);
sem_post(&full2); sem_post(&full2);
free(pr_divs->tail);
free(pr_divs);
} }
...@@ -434,9 +423,3 @@ int run (char *input,char *output){ ...@@ -434,9 +423,3 @@ int run (char *input,char *output){
return 0; return 0;
} }
/* int main() {
int err = run("input.txt", "actual_output.txt");
return err;
} */
...@@ -70,4 +70,4 @@ void thread_create_join(struct buffer_rc *ptr1,struct buffer_cw *ptr2,struct buf ...@@ -70,4 +70,4 @@ void thread_create_join(struct buffer_rc *ptr1,struct buffer_cw *ptr2,struct buf
int run (char *input,char *output); int run (char *input,char *output);
#endif #endif
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter