OpenFile
This commit is contained in:
@ -673,6 +673,38 @@ _end_find_in_queue:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// cerco
|
||||
int searchFile(queueT *q, char *filepath) {
|
||||
if(!q || !filepath) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LOCK_RETURN(&q->m, NULL); // begin me
|
||||
|
||||
if (q->len == 0)
|
||||
goto _end_search_file_in_queue;
|
||||
|
||||
nodeT *tmp = q->head;
|
||||
|
||||
while (tmp) {
|
||||
if (strcmp(filepath, (tmp->data)->filepath) == 0) { // trovato
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
if(!tmp)
|
||||
goto _end_search_file_in_queue;
|
||||
|
||||
UNLOCK_RETURN(&q->m, NULL); // end me
|
||||
return 1;
|
||||
|
||||
_end_search_file_in_queue:
|
||||
UNLOCK_RETURN(&q->m, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// numero di elementi della queue
|
||||
size_t getLen(queueT *q) {
|
||||
if(!q) {
|
||||
|
||||
Reference in New Issue
Block a user