taskrambler  0.1.9
Web server and task management solution.
interface.c File Reference
#include <sys/types.h>
#include <stdlib.h>
#include "class/interface.h"
#include "commons.h"
+ Include dependency graph for interface.c:

Go to the source code of this file.

Functions

static int comp (const void *_a, const void *_b)
 
iface_ptr interfaceGet (iface_impl_ptr iface_impl, const iface_ptr _iface)
 

Detailed Description

Author
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/.

Definition in file interface.c.

Function Documentation

static int comp ( const void *  _a,
const void *  _b 
)
inlinestatic

Definition at line 32 of file interface.c.

Referenced by interfaceGet(), treeDelete(), treeFind(), and treeInsert().

33 {
34  const struct interface * a = **(const struct interface ***)_a;
35  const struct interface * b = **(const struct interface ***)_b;
36  return ((a)<(b))? -1 : ((a)>(b))? 1 : 0;
37 }

+ Here is the caller graph for this function:

iface_ptr interfaceGet ( iface_impl_ptr  iface_impl,
const iface_ptr  _iface 
)

this one is important in selector functions to get the correct interface implementation of a class.

Definition at line 44 of file interface.c.

References comp(), and TRUE.

45 {
46  const iface_ptr * iface = &_iface;
47  iface_ptr * found;
48 
49  if (! iface_impl->simpl) {
50  qsort((void**)(iface_impl->impl), iface_impl->nimpl, sizeof(iface_ptr), comp);
52  }
53 
54  found = bsearch(
55  &iface,
58  sizeof(iface_ptr),
59  comp);
60 
61  return found? *found : (iface_ptr)NULL;
62 }
const struct interface * iface_ptr
Definition: interface.h:46
static int comp(const void *_a, const void *_b)
Definition: interface.c:32
const void * impl[MAX_IFACE]
Definition: interface.h:51
const size_t nimpl
Definition: interface.h:49
#define TRUE
Definition: commons.h:27
char simpl
Definition: interface.h:50

+ Here is the call graph for this function: