0002-shared-util-Rename-btd_malloc-to-util_malloc.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From f3263fed28bf510a1225661fe2b5f598300c11cd Mon Sep 17 00:00:00 2001
  2. From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  3. Date: Wed, 5 Jan 2022 15:53:35 -0800
  4. Subject: [PATCH] shared/util: Rename btd_malloc to util_malloc
  5. util functions are not limited to daemon only which is normally the case
  6. when using btd prefix.
  7. (cherry picked from commit 710220f861b100856711a0a4d4a852874228a57a)
  8. Signed-off-by: Thomas Devoogdt <thomas.devoogdt@gmail.com>
  9. ---
  10. profiles/audio/avdtp.c | 2 +-
  11. src/shared/util.c | 2 +-
  12. src/shared/util.h | 4 ++--
  13. 3 files changed, 4 insertions(+), 4 deletions(-)
  14. diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
  15. index d3dfbf96d..f2b461330 100644
  16. --- a/profiles/audio/avdtp.c
  17. +++ b/profiles/audio/avdtp.c
  18. @@ -1333,7 +1333,7 @@ static GSList *caps_to_list(uint8_t *data, size_t size,
  19. break;
  20. }
  21. - cpy = btd_malloc(sizeof(*cpy) + cap->length);
  22. + cpy = util_malloc(sizeof(*cpy) + cap->length);
  23. memcpy(cpy, cap, sizeof(*cap) + cap->length);
  24. size -= sizeof(*cap) + cap->length;
  25. diff --git a/src/shared/util.c b/src/shared/util.c
  26. index 81b20d86f..93110047b 100644
  27. --- a/src/shared/util.c
  28. +++ b/src/shared/util.c
  29. @@ -25,7 +25,7 @@
  30. #include "src/shared/util.h"
  31. -void *btd_malloc(size_t size)
  32. +void *util_malloc(size_t size)
  33. {
  34. if (__builtin_expect(!!size, 1)) {
  35. void *ptr;
  36. diff --git a/src/shared/util.h b/src/shared/util.h
  37. index ac70117ca..11d09979d 100644
  38. --- a/src/shared/util.h
  39. +++ b/src/shared/util.h
  40. @@ -75,7 +75,7 @@ do { \
  41. size_t __n = (size_t) (count); \
  42. size_t __s = sizeof(type); \
  43. void *__p; \
  44. - __p = btd_malloc(__n * __s); \
  45. + __p = util_malloc(__n * __s); \
  46. memset(__p, 0, __n * __s); \
  47. __p; \
  48. }))
  49. @@ -86,7 +86,7 @@ do { \
  50. char *strdelimit(char *str, char *del, char c);
  51. int strsuffix(const char *str, const char *suffix);
  52. -void *btd_malloc(size_t size);
  53. +void *util_malloc(size_t size);
  54. typedef void (*util_debug_func_t)(const char *str, void *user_data);
  55. --
  56. 2.17.1