Server 0.0.1
HTTP/REST server implementation

src/session/get.c

Go to the documentation of this file.
00001 
00023 #include <search.h>
00024 #include <time.h>
00025 
00026 #include "session.h"
00027 
00028 
00029 static
00030 inline
00031 int
00032 sessionGetComp(const void * _a, const void * _b)
00033 {
00034         unsigned long a = *(unsigned long *)_a;
00035         Session       b = (Session)_b;
00036         return (a < b->id)? -1 : (a > b->id)? 1 : 0;
00037 }
00038 
00039 Session
00040 sessionGet(const Session * root, const unsigned long id)
00041 {
00042         Session * found = tfind(&id, (void**)root, sessionGetComp);
00043 
00044         if (NULL == found) {
00045                 return NULL;
00046         }
00047 
00048         return *found;
00049 }
00050 
00051 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines