Change parameter type to pointer for performance
authorChanggyu Choi <changyu.choi@samsung.com>
Mon, 6 Jan 2025 08:26:01 +0000 (17:26 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Mon, 6 Jan 2025 08:30:37 +0000 (17:30 +0900)
unw_cursor_t is big structure type.
So, we can change this parameter type to pointer.

Change-Id: I08aa1bb855ea41127a74c65f1e0716436a5d096b
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/aul/aul_backtrace.cc

index 15fa82aeae0dca4d8f065b33b2f210c467fa5e99..583a21f5853d0942e8639be6dc8af0a014d7f2ef 100644 (file)
@@ -73,21 +73,21 @@ class Backtrace {
 
     fprintf(stderr, "[pid %d][Backtrace]\n", pid_);
     uint32_t index = 0;
-    Print(cursor, index++);
+    Print(&cursor, index++);
 
-    while (unw_step(&cursor) > 0) Print(cursor, index++);
+    while (unw_step(&cursor) > 0) Print(&cursor, index++);
 
     fflush(stderr);
   }
 
  private:
-  void Print(unw_cursor_t cursor, uint32_t index) {
+  void Print(unw_cursor_t* cursor, uint32_t index) {
     char func_name[256];
     unw_word_t pc;
-    unw_get_reg(&cursor, UNW_REG_IP, &pc);
+    unw_get_reg(cursor, UNW_REG_IP, &pc);
 
     unw_word_t offset;
-    if (!unw_get_proc_name(&cursor, func_name, sizeof(func_name), &offset)) {
+    if (!unw_get_proc_name(cursor, func_name, sizeof(func_name), &offset)) {
       fprintf(stderr, "[pid %d][%03u] 0x%zx: %s + 0x%zx [%s]\n", pid_, index, pc,
                     func_name, offset, GetModuleName(pc));
     } else {