Skip to content
Snippets Groups Projects
Commit c92bf337 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel: Committed by Sergey Kosukhin
Browse files

Delete no longer used source file and corresponding header entries.

parent f552abc0
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -244,7 +244,6 @@ libcdipio_la_SOURCES = \
pio_posixasynch.c \
pio_posixfpguardsendrecv.c \
pio_posixnonb.c \
pio_list_set.c \
resource_unpack.h \
resource_unpack.c \
pio_client.c \
......
......@@ -32,11 +32,6 @@ struct dBuffer
unsigned char *buffer;
};
typedef int (*valDestroyFunction)(void *);
typedef bool (*eqPredicate)(void *, void *);
typedef struct listSet listSet;
struct fileOpTag
{
int id;
......@@ -75,17 +70,6 @@ dbuffer_data_size(struct dBuffer *dbuffer)
return dbuffer->wr_pointer;
}
/* pio_list_set.c */
listSet *listSetNew(valDestroyFunction, eqPredicate);
void listSetDelete(listSet *);
int listSetAdd(listSet *, void *);
bool listSetIsEmpty(listSet *);
int listSetRemove(listSet *, int (*predicate)(void *, void *), void *data);
void *listSetGet(listSet *q, int (*predicate)(void *, void *), void *data);
typedef void (*elemOp)(void *elem, void *data);
void listSetForeach(listSet *q, elemOp func, void *data);
/* pio_mpinonb.c */
void initMPINONB(void);
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "cdi.h"
#include "dmemory.h"
#include "pio_impl.h"
#include "pio_util.h"
struct cons
{
void *val;
struct cons *next;
};
struct listSet
{
struct cons *head, *tail;
valDestroyFunction valDestroy;
eqPredicate keyCompare;
int count;
};
listSet *
listSetNew(valDestroyFunction vD, eqPredicate kC)
{
listSet *myq;
myq = (listSet *) Malloc(sizeof(listSet));
myq->head = NULL;
myq->tail = NULL;
myq->valDestroy = vD;
myq->keyCompare = kC;
myq->count = 0;
return myq;
}
void
listSetDelete(listSet *q)
{
struct cons *curr, *succ;
if (q->head)
{
curr = q->head;
while (curr)
{
succ = curr->next;
(*(q->valDestroy))(curr->val);
Free(curr);
curr = succ;
}
}
Free(q);
return;
}
int
listSetAdd(listSet *q, void *v)
{
struct cons *newCons;
{
struct cons *p;
for (p = q->head; p; p = p->next)
// ensure unique keys
if (q->keyCompare(v, p->val)) return -1;
}
if ((newCons = (struct cons *) Malloc(sizeof(struct cons))) == NULL)
{
perror("pio_listSet: listSetAdd (): Not enough memory");
/* FIXME: why not abort? */
return 1;
}
newCons->val = v;
newCons->next = NULL;
if (q->tail != NULL)
q->tail->next = newCons;
else
q->head = newCons;
q->tail = newCons;
return q->count++;
}
int
listSetRemove(listSet *q, int (*predicate)(void *, void *), void *data)
{
struct cons **p;
for (p = &q->head; *p; p = &(*p)->next)
if (predicate((*p)->val, data))
{
struct cons *rem = *p;
if (rem == q->tail) q->tail = NULL;
int iret = q->valDestroy(rem->val);
*p = rem->next;
q->count--;
Free(rem);
return iret;
}
return -1;
}
void *
listSetGet(listSet *q, int (*predicate)(void *, void *), void *data)
{
struct cons *p;
xassert(q && predicate);
for (p = q->head; p; p = p->next)
if (predicate(p->val, data)) return p->val;
return NULL;
}
bool
listSetIsEmpty(listSet *q)
{
return q->head == NULL;
}
void
listSetForeach(listSet *q, void (*func)(void *elem, void *data), void *data)
{
struct cons *p;
for (p = q->head; p; p = p->next) func(p->val, data);
}
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment