source: libcaca/trunk/cucul/buffer.c @ 859

Last change on this file since 859 was 859, checked in by Sam Hocevar, 14 years ago
  • Removed duplicate uint*_t defines from *_internal.h and included common.h in all .c files that needed it.
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/*
2 *  libcucul      Canvas for ultrafast compositing of Unicode letters
3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: buffer.c 859 2006-04-24 20:35:59Z sam $
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14/*
15 *  This file contains buffer handling functions.
16 */
17
18#include "config.h"
19#include "common.h"
20
21#if !defined(__KERNEL__)
22#   include <stdio.h>
23#   include <stdlib.h>
24#   include <string.h>
25#endif
26
27#include "cucul.h"
28#include "cucul_internals.h"
29
30/** \brief Get the buffer size.
31 *
32 *  This function returns the length (in bytes) of the memory area stored
33 *  in the given \e libcucul buffer.
34 *
35 *  \param buf A \e libcucul buffer
36 *  \return The buffer data length.
37 */
38unsigned long int cucul_get_buffer_size(cucul_buffer_t *buf)
39{
40    return buf->size;
41}
42
43/** \brief Get the buffer data.
44 *
45 *  This function returns a pointer to the memory area stored in the given
46 *  \e libcucul buffer.
47 *
48 *  \param buf A \e libcucul buffer
49 *  \return A pointer to the buffer memory area.
50 */
51void * cucul_get_buffer_data(cucul_buffer_t *buf)
52{
53    return buf->data;
54}
55
56/** \brief Free a buffer.
57 *
58 *  This function frees the structures associated with the given
59 *  \e libcucul buffer.
60 *
61 *  \param buf A \e libcucul buffer
62 */
63void cucul_free_buffer(cucul_buffer_t *buf)
64{
65    free(buf->data);
66    free(buf);
67}
68
Note: See TracBrowser for help on using the repository browser.