Diff for /libaitrpc/src/lists.c between versions 1.11.2.1 and 1.17.4.1

version 1.11.2.1, 2012/11/13 09:21:27 version 1.17.4.1, 2015/07/02 22:20:48
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012Copyright 2004 - 2015
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 46  SUCH DAMAGE. Line 46  SUCH DAMAGE.
 #include "global.h"  #include "global.h"
   
   
   #pragma GCC visibility push(hidden)
   
   static int
   rpc_funcs_cmp(struct tagRPCFunc *a, struct tagRPCFunc *b)
   {
           int ret;
   
           assert(a && b);
   
           ret = AIT_KEY(&a->func_name) - AIT_KEY(&b->func_name);
   
           if (ret < 0)
                   return -1;
           else if (ret > 0)
                   return 1;
   
           return ret;
   }
   
   AVL_GENERATE(tagRPCFuncs, tagRPCFunc, func_node, rpc_funcs_cmp);
   
   #pragma GCC visibility pop
   
 /*  /*
  * rpc_srv_registerCall() - Register call to RPC server   * rpc_srv_registerCall() - Register call to RPC server
  *   *
Line 64  rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho Line 87  rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
                 return -1;                  return -1;
         }          }
   
        if (!(func = io_malloc(sizeof(rpc_func_t)))) {        if (!(func = e_malloc(sizeof(rpc_func_t)))) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
         } else {          } else {
Line 74  rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho Line 97  rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
   
         /* search for duplicate */          /* search for duplicate */
         if (AVL_FIND(tagRPCFuncs, &srv->srv_funcs, func)) {          if (AVL_FIND(tagRPCFuncs, &srv->srv_funcs, func)) {
                io_free(func);                e_free(func);
                 return 0;                  return 0;
         }          }
   
Line 116  rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s Line 139  rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s
         RPC_FUNCS_UNLOCK(&srv->srv_funcs);          RPC_FUNCS_UNLOCK(&srv->srv_funcs);
   
         AIT_FREE_VAL(&f->func_name);          AIT_FREE_VAL(&f->func_name);
        io_free(f);        e_free(f);
         return 1;          return 1;
 }  }
   
Line 127  rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s Line 150  rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s
  * @tag = tag for function   * @tag = tag for function
  * return: NULL not found call, !=NULL return call   * return: NULL not found call, !=NULL return call
  */   */
inline rpc_func_t *rpc_func_t *
 rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t tag)  rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t tag)
 {  {
         rpc_func_t tmp;          rpc_func_t tmp;
Line 151  rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t t Line 174  rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t t
  * @var = hash for variable   * @var = hash for variable
  * return: NULL not found, !=NULL return blob var   * return: NULL not found, !=NULL return blob var
  */   */
inline rpc_blob_t *rpc_blob_t *
 rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t var)  rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t var)
 {  {
         rpc_blob_t *b, *tmp;          rpc_blob_t *b, *tmp;
Line 173  rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t v Line 196  rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t v
  *   *
  * @srv = RPC Server instance   * @srv = RPC Server instance
  * @len = BLOB length   * @len = BLOB length
    * @tout = BLOB live timeout in seconds
  * return: NULL error or new registered BLOB   * return: NULL error or new registered BLOB
  */   */
 rpc_blob_t *  rpc_blob_t *
rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_t len)rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_t len, int tout)
 {  {
         rpc_blob_t *blob = NULL;          rpc_blob_t *blob = NULL;
   
Line 185  rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_ Line 209  rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_
                 return blob;                  return blob;
         }          }
   
        blob = rpc_srv_blobCreate(srv, len);        blob = rpc_srv_blobCreate(srv, len, tout);
   
         TAILQ_INSERT_TAIL(&srv->srv_blob.blobs, blob, blob_node);          TAILQ_INSERT_TAIL(&srv->srv_blob.blobs, blob, blob_node);
   
         return blob;          return blob;
 }  }
   
Line 215  rpc_srv_unregisterBLOB(rpc_srv_t * __restrict srv, uin Line 240  rpc_srv_unregisterBLOB(rpc_srv_t * __restrict srv, uin
         TAILQ_REMOVE(&srv->srv_blob.blobs, b, blob_node);          TAILQ_REMOVE(&srv->srv_blob.blobs, b, blob_node);
   
         rpc_srv_blobFree(srv, b);          rpc_srv_blobFree(srv, b);
        io_free(b);        e_free(b);
         return 1;          return 1;
 }  }

Removed from v.1.11.2.1  
changed lines
  Added in v.1.17.4.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>