add_block_in_order.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2011 Institute of Communication and Computer Systems (ICCS)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. /**
  18. * \file add_block_in_order.h
  19. * \author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * \date January, 2012
  21. *
  22. * \brief Add a block in an ordered linked list.
  23. */
  24. #ifndef ADD_BLOCK_IN_ORDER_H
  25. #define ADD_BLOCK_IN_ORDER_H
  26. #include <stdbool.h>
  27. #include "dmm_config.h"
  28. #ifdef COUNT_HOPS
  29. #include <dmmlib/heap.h>
  30. #endif /* COUNT_HOPS */
  31. /**
  32. * Adds a block in an ordered list.
  33. *
  34. * @param block The pointer of the data part of the block to be added.
  35. * @param starting_node The pointer to the starting memory block of the list.
  36. * @param search_condition Function pointer of the search condition.
  37. */
  38. #ifdef COUNT_HOPS
  39. /*
  40. * @param heap A pointer to the heap which manages the block.
  41. */
  42. void add_block_in_order(
  43. heap_t *heap,
  44. void **block,
  45. void **starting_node,
  46. bool (*search_condition)(void *block, void* comparing_block));
  47. #else /* COUNT_HOPS */
  48. void add_block_in_order(
  49. void **block,
  50. void **starting_node,
  51. bool (*search_condition)(void *block, void* comparing_block));
  52. #endif /* COUNT_HOPS */
  53. #endif /* ADD_BLOCK_IN_ORDER_H */