GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATUtil.h

Go to the documentation of this file.
00001 /** @file GATUtil.h
00002  *  Source file for the different utility functions used throughout the GAT 
00003  *  engine.
00004  *
00005  *  @date Mon Oct 20 2003
00006  *
00007  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATUtil.h,v 1.7 2004/04/06 07:58:41 hartmutkaiser Exp $
00008  *
00009  *  Copyright (C) Hartmut Kaiser
00010  *  This file is part of the GAT Engine.
00011  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00012  *
00013  *  Use, modification and distribution is subject to the Gridlab Software
00014  *  License. (See accompanying file GLlicense.txt or copy at
00015  *  http://www.gridlab.org/GLlicense.txt)
00016  */
00017  
00018 #if !defined(_GATUTIL_H_)
00019 #define _GATUTIL_H_
00020 
00021 #include "GATType.h"
00022 
00023 /** char *GATUtil_strdup(char const *str)
00024  *  @brief Make a copy of a given string 
00025  *
00026  *  The function GATUtil_strdup allocates a new copy of the given string. The 
00027  *  return value should be free'd by the caller by means of the function 
00028  *  free().
00029  *  Since strdup isn't POSIX, we need to provide our own.
00030  *
00031  *  @param str The string to be copied.
00032  *
00033  *  @return Returns the allocated string copy.
00034  */
00035 char *GATUtil_strdup(char const *str);
00036 
00037 /** void *GATUtil_memdup(void const *str, GATuint32 size)
00038  *  @brief Make a copy of a given memory buffer 
00039  *
00040  *  The function GATUtil_memdup allocates a new copy of the given memory 
00041  *  buffer. The return value should be free'd by the caller by means of the 
00042  *  function free().
00043  *
00044  *  @param buffer The memory buffer to be copied.
00045  *
00046  *  @return Returns the allocated memory buffer copy.
00047  */
00048 void *GATUtil_memdup(void const *str, GATuint32 size);
00049 
00050 /** GATUtil_appendstring
00051  *  @brief Append a string to a given string.
00052  *
00053  *  The function GATUtil_appendstring appends a string to a given string 
00054  *  assuming, that the given string was allocated by malloc.
00055  *
00056  *  @param str The pointer to the string pointer, which contains the string
00057  *        to which the to_append string should be appended. May be zero, in 
00058  *        wich case a new buffer is allocated and returned.
00059  *  @param to_append The string to append
00060  *
00061  *  @return An error code.
00062  */
00063 GATResult GATUtil_appendstring(char **str, char const *to_append);
00064 
00065 #endif /* !defined(_GATUTIL_H_) */