coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gl: heap_insert function modifies the return value to void


From: Li kunyu
Subject: [PATCH] gl: heap_insert function modifies the return value to void
Date: Tue, 7 Jun 2022 17:28:42 +0800

Change function to return type void to reduce eax register calls.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 gl/lib/heap.c | 4 +---
 gl/lib/heap.h | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gl/lib/heap.c b/gl/lib/heap.c
index 30584adca..a10d426b0 100644
--- a/gl/lib/heap.c
+++ b/gl/lib/heap.c
@@ -75,7 +75,7 @@ heap_free (struct heap *heap)
 
 /* Insert element into heap. */
 
-int
+void
 heap_insert (struct heap *heap, void *item)
 {
   if (heap->capacity - 1 <= heap->count)
@@ -84,8 +84,6 @@ heap_insert (struct heap *heap, void *item)
 
   heap->array[++heap->count] = item;
   heapify_up (heap->array, heap->count, heap->compare);
-
-  return 0;
 }
 
 /* Pop top element off heap. */
diff --git a/gl/lib/heap.h b/gl/lib/heap.h
index 895c375fc..7c0b9964b 100644
--- a/gl/lib/heap.h
+++ b/gl/lib/heap.h
@@ -28,5 +28,5 @@ struct heap *heap_alloc (int (*) (void const *, void const 
*), size_t)
   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (heap_free, 1)
   _GL_ATTRIBUTE_RETURNS_NONNULL;
 
-int heap_insert (struct heap *heap, void *item) _GL_ATTRIBUTE_NONNULL ();
+void heap_insert (struct heap *heap, void *item) _GL_ATTRIBUTE_NONNULL ();
 void *heap_remove_top (struct heap *heap) _GL_ATTRIBUTE_NONNULL ();
-- 
2.18.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]