Galago - desktop presence framework

galago-utils.h File Reference

Utility functions. More...

#include <stdlib.h>

Go to the source code of this file.


Memory allocation functions

#define galago_new(struct_type, n_structs)   ((struct_type *)malloc(sizeof(struct_type) * (n_structs)))
#define galago_new0(struct_type, n_structs)   ((struct_type *)galago_malloc0(sizeof(struct_type) * (n_structs)))
void * galago_malloc0 (size_t bytes)
 Allocates a block of memory and sets the bytes to 0.
void * galago_memdup (const void *ptr, size_t size)
 Duplicates a block of memory of the specified size.

String functions

char * galago_str_lower (const char *str)
 Converts a string to lowercase.
char * galago_str_upper (const char *str)
 Converts a string to uppercase.

Detailed Description

Utility functions.

Copyright:
(C) 2004-2005 Christian Hammond
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file galago-utils.h.


Function Documentation

void* galago_malloc0 size_t  bytes  ) 
 

Allocates a block of memory and sets the bytes to 0.

Parameters:
bytes The number of bytes to allocate.
Returns:
The new block of memory.

void* galago_memdup const void *  ptr,
size_t  size
 

Duplicates a block of memory of the specified size.

Parameters:
ptr The memory to duplicate.
size The size of the block.
Returns:
The new duplicated block of memory.

char* galago_str_lower const char *  str  ) 
 

Converts a string to lowercase.

Parameters:
str The string.
Returns:
The new string.

char* galago_str_upper const char *  str  ) 
 

Converts a string to uppercase.

Parameters:
str The string.
Returns:
The new string.