FACT++  1.0
int allocateMemory ( unsigned int  size,
char  type,
char *  module,
char  prefixPurpose,
void **  ptr 
)

Definition at line 3852 of file feeserver.c.

References createLogMessage(), createMemoryNode(), size, and sprintf().

3853  {
3854  MemoryNode* memNode = 0;
3855  unsigned int realSize = 0;
3856  unsigned int addSize = 0;
3857  char msg[200];
3858  *ptr = 0;
3859 
3860  if (size == 0) {
3861  createLogMessage(MSG_WARNING,
3862  "FeeServer shall allocate memory of size 0; discarding call!", 0);
3863 # ifdef __DEBUG
3864  printf("FeeServer shall allocate memory of size 0; discarding call!\n");
3865  fflush(stdout);
3866 # endif
3867  return FEE_INVALID_PARAM;
3868  }
3869 
3870  switch (prefixPurpose) {
3871  case ('0'):
3872  realSize = size;
3873  break;
3874 
3875  case ('A'):
3876  realSize = size + HEADER_SIZE;
3877  addSize = HEADER_SIZE;
3878  break;
3879 
3880  default:
3881  msg[sprintf(msg,
3882  "Received allocateMemory call with unknown prefix purpose ('%c'), discarding call.",
3883  prefixPurpose)] = 0;
3884  createLogMessage(MSG_ERROR, msg, 0);
3885 # ifdef __DEBUG
3886  printf("%s\n", msg);
3887  fflush(stdout);
3888 # endif
3889  return FEE_INVALID_PARAM;
3890  }
3891 
3892  memNode = createMemoryNode(realSize, type, module, addSize);
3893  if (memNode == 0) {
3894  return FEE_FAILED;
3895  }
3896 
3897  *ptr = memNode->identityAddr;
3898 /* // only for debug output to test functyionality
3899  msg[sprintf(msg,
3900  "Allocated memory (type %c) for %s of size %d + prefix memory size %d. Purpose is set to: %c.",
3901  type, memNode->mmData.memDest, size, addSize, prefixPurpose)] = 0;
3902  createLogMessage(MSG_DEBUG, msg, 0);
3903 # ifdef __DEBUG
3904  printf("%s\n", msg);
3905  fflush(stdout);
3906 # endif
3907 */
3908  return FEE_OK;
3909 }
void createLogMessage(unsigned int type, char *description, char *origin)
Definition: feeserver.c:1530
int type
int size
Definition: db_dim_server.c:17
MemoryNode * createMemoryNode(unsigned int size, char type, char *module, unsigned int preSize)
Definition: feeserver.c:3732
sprintf(name1,"NewService%d", i)

+ Here is the call graph for this function: