Browse Source
add more list like functions to the queue .. they are not used now and not testes, so they probably have bugs.
1.0.0
add more list like functions to the queue .. they are not used now and not testes, so they probably have bugs.
1.0.0
7 changed files with 129 additions and 98 deletions
-
2.gitignore
-
9include/tr/queue.h
-
9src/queue/Makefile.am
-
42src/queue/delete.c
-
36src/queue/find.c
-
36src/queue/find_parent.c
-
93trdata.h
@ -0,0 +1,42 @@ |
|||
/** |
|||
* \file |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2014 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#include "trbase.h" |
|||
#include "tr/queue.h" |
|||
|
|||
void |
|||
TR_queueDelete(TR_Queue this, void * msg) |
|||
{ |
|||
TR_Queue node, parent = TR_queueFindParent(this, msg); |
|||
|
|||
if (! parent) return; |
|||
|
|||
node = parent->next; |
|||
parent->next = node->next; |
|||
if (node == this->last) { |
|||
this->last = parent; |
|||
} |
|||
TR_delete(node); |
|||
this->nmsg--; |
|||
} |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -0,0 +1,36 @@ |
|||
/** |
|||
* \file |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2014 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#include "trbase.h" |
|||
#include "tr/queue.h" |
|||
|
|||
TR_Queue |
|||
TR_queueFind(TR_Queue this, void * msg) |
|||
{ |
|||
TR_Queue node; |
|||
|
|||
for (node = this->first; node && node->msg != msg; node = node->next); |
|||
|
|||
return node; |
|||
} |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -0,0 +1,36 @@ |
|||
/** |
|||
* \file |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2014 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#include "trbase.h" |
|||
#include "tr/queue.h" |
|||
|
|||
TR_Queue |
|||
TR_queueFindParent(TR_Queue this, void * msg) |
|||
{ |
|||
TR_Queue node; |
|||
|
|||
for (node = this; node->next && node->next->msg != msg; node = node->next); |
|||
|
|||
return node->next ? node : NULL; |
|||
} |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -1,93 +0,0 @@ |
|||
/* trdata.h. Generated from trdata.h.in by configure. */ |
|||
/* trdata.h.in. Generated from configure.ac by autoheader. */ |
|||
|
|||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|||
#define HAVE_DLFCN_H 1 |
|||
|
|||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|||
#define HAVE_INTTYPES_H 1 |
|||
|
|||
/* Define to 1 if you have the <memory.h> header file. */ |
|||
#define HAVE_MEMORY_H 1 |
|||
|
|||
/* Define to 1 if you have the `memset' function. */ |
|||
#define HAVE_MEMSET 1 |
|||
|
|||
/* Define to 1 if you have the <stdarg.h> header file. */ |
|||
#define HAVE_STDARG_H 1 |
|||
|
|||
/* Define to 1 if stdbool.h conforms to C99. */ |
|||
#define HAVE_STDBOOL_H 1 |
|||
|
|||
/* Define to 1 if you have the <stdint.h> header file. */ |
|||
#define HAVE_STDINT_H 1 |
|||
|
|||
/* Define to 1 if you have the <stdio.h> header file. */ |
|||
#define HAVE_STDIO_H 1 |
|||
|
|||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|||
#define HAVE_STDLIB_H 1 |
|||
|
|||
/* Define to 1 if you have the <strings.h> header file. */ |
|||
#define HAVE_STRINGS_H 1 |
|||
|
|||
/* Define to 1 if you have the <string.h> header file. */ |
|||
#define HAVE_STRING_H 1 |
|||
|
|||
/* Define to 1 if you have the <syslog.h> header file. */ |
|||
#define HAVE_SYSLOG_H 1 |
|||
|
|||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|||
#define HAVE_SYS_STAT_H 1 |
|||
|
|||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|||
#define HAVE_SYS_TYPES_H 1 |
|||
|
|||
/* Define to 1 if you have the <unistd.h> header file. */ |
|||
#define HAVE_UNISTD_H 1 |
|||
|
|||
/* Define to 1 if the system has the type `_Bool'. */ |
|||
#define HAVE__BOOL 1 |
|||
|
|||
/* Define to the sub-directory in which libtool stores uninstalled libraries. |
|||
*/ |
|||
#define LT_OBJDIR ".libs/" |
|||
|
|||
/* Name of package */ |
|||
#define PACKAGE "libtrhash" |
|||
|
|||
/* Define to the address where bug reports for this package should be sent. */ |
|||
#define PACKAGE_BUGREPORT "Georg Hopp <georg@steffers.org>" |
|||
|
|||
/* Define to the full name of this package. */ |
|||
#define PACKAGE_NAME "libtrhash" |
|||
|
|||
/* Define to the full name and version of this package. */ |
|||
#define PACKAGE_STRING "libtrhash 0.0.0" |
|||
|
|||
/* Define to the one symbol short name of this package. */ |
|||
#define PACKAGE_TARNAME "libtrhash" |
|||
|
|||
/* Define to the home page for this package. */ |
|||
#define PACKAGE_URL "" |
|||
|
|||
/* Define to the version of this package. */ |
|||
#define PACKAGE_VERSION "0.0.0" |
|||
|
|||
/* Define to 1 if you have the ANSI C header files. */ |
|||
#define STDC_HEADERS 1 |
|||
|
|||
/* Version number of package */ |
|||
#define VERSION "0.0.0" |
|||
|
|||
/* Define to `__inline__' or `__inline' if that's what the C compiler |
|||
calls it, or to nothing if 'inline' is not supported under any name. */ |
|||
#ifndef __cplusplus |
|||
/* #undef inline */ |
|||
#endif |
|||
|
|||
/* Define to `int' if <sys/types.h> does not define. */ |
|||
/* #undef pid_t */ |
|||
|
|||
/* Define to `unsigned int' if <sys/types.h> does not define. */ |
|||
/* #undef size_t */ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue