Skip to content

Commit

Permalink
[kernel] 补充endif后缀注释(3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf committed Jun 10, 2021
1 parent e019a57 commit 8b53609
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 108 deletions.
30 changes: 15 additions & 15 deletions src/memheap.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void rt_mem_set_tag(void *ptr, const char *name)
rt_memheap_setname(item, name);
}
}
#endif
#endif /* RT_USING_MEMTRACE */

/*
* The initialized memory pool will be:
Expand Down Expand Up @@ -127,7 +127,7 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap,

#ifdef RT_USING_MEMTRACE
rt_memset(item->owner_thread_name, ' ', sizeof(item->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

item->next = (struct rt_memheap_item *)
((rt_uint8_t *)item + memheap->available_size + RT_MEMHEAP_SIZE);
Expand Down Expand Up @@ -252,7 +252,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)

#ifdef RT_USING_MEMTRACE
rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

/* break down the block list */
new_ptr->prev = header_ptr;
Expand Down Expand Up @@ -310,7 +310,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->name, sizeof(header_ptr->owner_thread_name));
else
rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

/* release lock */
rt_sem_release(&(heap->lock));
Expand Down Expand Up @@ -439,7 +439,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)

#ifdef RT_USING_MEMTRACE
rt_memset(next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

next_ptr->prev = header_ptr;
next_ptr->next = header_ptr->next;
Expand Down Expand Up @@ -507,7 +507,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)

#ifdef RT_USING_MEMTRACE
rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

/* break down the block list */
new_ptr->prev = header_ptr;
Expand Down Expand Up @@ -660,7 +660,7 @@ void rt_memheap_free(void *ptr)

#ifdef RT_USING_MEMTRACE
rt_memset(header_ptr->owner_thread_name, ' ', sizeof(header_ptr->owner_thread_name));
#endif
#endif /* RT_USING_MEMTRACE */

/* release lock */
rt_sem_release(&(heap->lock));
Expand Down Expand Up @@ -750,7 +750,7 @@ int memheaptrace(void)
return 0;
}
MSH_CMD_EXPORT(memheaptrace, dump memory trace information);
#endif
#endif /* RT_USING_FINSH */

#ifdef RT_USING_MEMHEAP_AS_HEAP
static struct rt_memheap _heap;
Expand Down Expand Up @@ -816,7 +816,7 @@ void *rt_malloc(rt_size_t size)

RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("malloc => 0x%08x : %d", ptr, size));
}
#endif
#endif /* RT_USING_MEMTRACE */

return ptr;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("realloc => 0x%08x : %d",
new_ptr, newsize));
}
#endif
#endif /* RT_USING_MEMTRACE */

return new_ptr;
}
Expand Down Expand Up @@ -912,7 +912,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("calloc => 0x%08x : %d",
ptr, count * size));
}
#endif
#endif /* RT_USING_MEMTRACE */

return ptr;
}
Expand All @@ -932,7 +932,7 @@ void rt_memory_info(rt_uint32_t *total,
*max_used = _heap.max_used_size;
}

#endif
#endif /* RT_USING_MEMHEAP_AS_HEAP */

#ifdef RT_USING_MEMTRACE

Expand Down Expand Up @@ -1004,8 +1004,8 @@ void memtrace_heap()
#ifdef RT_USING_FINSH
#include <finsh.h>
MSH_CMD_EXPORT(memtrace_heap, dump memory trace for heap);
#endif /* end of RT_USING_FINSH */
#endif /* RT_USING_FINSH */

#endif /* end of RT_USING_MEMTRACE */
#endif /* RT_USING_MEMTRACE */

#endif /* end of RT_USING_MEMHEAP */
#endif /* RT_USING_MEMHEAP */
7 changes: 3 additions & 4 deletions src/mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block))
}

/**@}*/
#endif
#endif /* RT_USING_HOOK */

/**
* @addtogroup MM
Expand Down Expand Up @@ -290,7 +290,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
return RT_EOK;
}
RTM_EXPORT(rt_mp_delete);
#endif
#endif /* RT_USING_HEAP */

/**
* This function will allocate a block from memory pool
Expand Down Expand Up @@ -451,5 +451,4 @@ RTM_EXPORT(rt_mp_free);

/**@}*/

#endif

#endif /* RT_USING_MEMPOOL */
14 changes: 7 additions & 7 deletions src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#ifdef RT_USING_MODULE
#include <dlmodule.h>
#endif
#endif /* RT_USING_MODULE */

/*
* define object_info for the number of rt_object_container items.
Expand Down Expand Up @@ -189,7 +189,7 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object))
}

/**@}*/
#endif
#endif /* RT_USING_HOOK */

/**
* @addtogroup KernelObject
Expand Down Expand Up @@ -305,7 +305,7 @@ void rt_object_init(struct rt_object *object,
struct rt_object_information *information;
#ifdef RT_USING_MODULE
struct rt_dlmodule *module = dlmodule_self();
#endif
#endif /* RT_USING_MODULE */

/* get object information */
information = rt_object_get_information(type);
Expand Down Expand Up @@ -349,7 +349,7 @@ void rt_object_init(struct rt_object *object,
object->module_id = (void *)module;
}
else
#endif
#endif /* RT_USING_MODULE */
{
/* insert object into information object list */
rt_list_insert_after(&(information->object_list), &(object->list));
Expand Down Expand Up @@ -403,7 +403,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
struct rt_object_information *information;
#ifdef RT_USING_MODULE
struct rt_dlmodule *module = dlmodule_self();
#endif
#endif /* RT_USING_MODULE */

RT_DEBUG_NOT_IN_INTERRUPT;

Expand Down Expand Up @@ -444,7 +444,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
object->module_id = (void *)module;
}
else
#endif
#endif /* RT_USING_MODULE */
{
/* insert object into information object list */
rt_list_insert_after(&(information->object_list), &(object->list));
Expand Down Expand Up @@ -487,7 +487,7 @@ void rt_object_delete(rt_object_t object)
/* free the memory of object */
RT_KERNEL_FREE(object);
}
#endif
#endif /* RT_USING_HEAP */

/**
* This function will judge the object is system object or not.
Expand Down
Loading

0 comments on commit 8b53609

Please sign in to comment.