Simplify get_label() and get_frame_id()
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 6 Oct 2023 21:51:42 +0000 (17:51 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 7 Oct 2023 15:51:24 +0000 (11:51 -0400)
Remove return values.

fgen.sh

diff --git a/fgen.sh b/fgen.sh
index 45b3001..6e66b49 100755 (executable)
--- a/fgen.sh
+++ b/fgen.sh
@@ -50,27 +50,16 @@ function get_pos()
 # Arg1: line
 function get_label()
 {
-    frame=$(echo "${1}" | ${SED} "s/.*label:\(.*\),geometry.*/\1/g")
-
-    if [ x"${frame}" = x"" ]; then
-        echo ""
-        return 1
-    else
-        echo "${frame}"
-        return 0
-    fi
+    local token
+    token=$(echo "${1}" | ${SED} "s/.*label:\(.*\),geometry.*/\1/g")
+    echo "${token}"
 }
 
 # Arg1: line
 function get_frame_id()
 {
     frame=$(echo "${1}" | grep -e "label:[0-9]\+," | ${SED} "s/.*label:\([0-9]\+\),.*/\1/g")
-
-    if [ x"${frame}" = x"" ]; then
-        echo ""
-    else
-        echo "${frame}"
-    fi
+    echo "${frame}"
 }
 
 # Arg1: line