You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
1.5 KiB

  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$
  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. * This file contains buffer handling functions.
  15. */
  16. #include "config.h"
  17. #include "common.h"
  18. #if !defined(__KERNEL__)
  19. # include <stdio.h>
  20. # include <stdlib.h>
  21. # include <string.h>
  22. #endif
  23. #include "cucul.h"
  24. #include "cucul_internals.h"
  25. /** \brief Get the buffer size.
  26. *
  27. * This function returns the length (in bytes) of the memory area stored
  28. * in the given \e libcucul buffer.
  29. *
  30. * \param buf A \e libcucul buffer
  31. * \return The buffer data length.
  32. */
  33. unsigned long int cucul_get_buffer_size(cucul_buffer_t *buf)
  34. {
  35. return buf->size;
  36. }
  37. /** \brief Get the buffer data.
  38. *
  39. * This function returns a pointer to the memory area stored in the given
  40. * \e libcucul buffer.
  41. *
  42. * \param buf A \e libcucul buffer
  43. * \return A pointer to the buffer memory area.
  44. */
  45. void * cucul_get_buffer_data(cucul_buffer_t *buf)
  46. {
  47. return buf->data;
  48. }
  49. /** \brief Free a buffer.
  50. *
  51. * This function frees the structures associated with the given
  52. * \e libcucul buffer.
  53. *
  54. * \param buf A \e libcucul buffer
  55. */
  56. void cucul_free_buffer(cucul_buffer_t *buf)
  57. {
  58. free(buf->data);
  59. free(buf);
  60. }