Skip to content

Commit

Permalink
Remove unnecessary return statements
Browse files Browse the repository at this point in the history
stablestud committed Oct 29, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2f96302 commit 0683be2
Showing 8 changed files with 0 additions and 82 deletions.
8 changes: 0 additions & 8 deletions src/bin/adsorber
Original file line number Diff line number Diff line change
@@ -48,8 +48,6 @@ checkRoot()

checkPaths
sourceFiles

return 0
}


@@ -62,8 +60,6 @@ checkForWrongParameters()
if [ -n "${_wrong_operation}" ] || [ -n "${_wrong_option}" ]; then
showUsage
fi

return 0
}


@@ -313,8 +309,6 @@ checkPaths()
fi

unset _not_found

return 0
}


@@ -342,8 +336,6 @@ sourceFiles()
. "${library_dir_path}/cron/cron.sh"
# shellcheck source=../src/lib/systemd/systemd.sh
. "${library_dir_path}/systemd/systemd.sh"

return 0
}


4 changes: 0 additions & 4 deletions src/lib/cleanup.sh
Original file line number Diff line number Diff line change
@@ -51,8 +51,6 @@ errorCleanUp()
if [ -d "${tmp_dir_path}" ]; then
rm -r "${tmp_dir_path}"
fi

return 0
}


@@ -63,6 +61,4 @@ cleanUp()

# Remove the /tmp/adsorber directory
rm -r "${tmp_dir_path}"

return 0
}
16 changes: 0 additions & 16 deletions src/lib/config.sh
Original file line number Diff line number Diff line change
@@ -42,8 +42,6 @@ config_CreateTmpDir()
rm -rf "${tmp_dir_path}"
mkdir "${tmp_dir_path}"
fi

return 0
}


@@ -54,8 +52,6 @@ config_CopySourceList()
cp "${shareable_dir_path}/default/default-sources.list" "${config_dir_path}/sources.list" \
&& echo "${prefix_warning}Created sources.list - to add new host sources edit this file."
fi

return 0
}


@@ -66,8 +62,6 @@ config_CopyWhiteList()
cp "${shareable_dir_path}/default/default-whitelist" "${config_dir_path}/whitelist" \
&& echo "${prefix_warning}Created whitelist - to allow specific domains edit this file."
fi

return 0
}


@@ -78,8 +72,6 @@ config_CopyBlackList()
cp "${shareable_dir_path}/default/default-blacklist" "${config_dir_path}/blacklist" \
&& echo "${prefix_warning}Created blacklist - to block additional domains edit this file."
fi

return 0
}


@@ -95,8 +87,6 @@ config_CopyConfig()

exit 126
fi

return 0
}


@@ -123,8 +113,6 @@ config_FilterConfig()
sed -n "/^hosts_file_previous_path=/p" "${tmp_dir_path}/config"
sed -n "/^systemd_dir_path=/p" "${tmp_dir_path}/config"
} > "${tmp_dir_path}/config-filtered"

return 0
}


@@ -238,8 +226,6 @@ config_ReadConfig()
done < "${tmp_dir_path}/config-filtered"

unset _line

return 0
}


@@ -299,8 +285,6 @@ config_IsVariableSet()
errorCleanUp
exit 127
fi

return 0
}


8 changes: 0 additions & 8 deletions src/lib/disable.sh
Original file line number Diff line number Diff line change
@@ -51,8 +51,6 @@ disable_Prompt()
exit 130
;;
esac

return 0
}


@@ -70,8 +68,6 @@ disable_HostsFile()
errorCleanUp
exit 1
fi

return 0
}


@@ -84,8 +80,6 @@ disable_PreviousHostsFile()
else
echo "${prefix}Previous hosts file does not exist. Ignoring ..."
fi

return 0
}


@@ -99,6 +93,4 @@ disable()
disable_HostsFile
disable_PreviousHostsFile
cleanUp

return 0
}
4 changes: 0 additions & 4 deletions src/lib/restore.sh
Original file line number Diff line number Diff line change
@@ -48,8 +48,6 @@ restore_HostsFile()
errorCleanUp
exit 1
fi

return 0
}


@@ -59,6 +57,4 @@ restore()
printf "%bRestoring %s ...%b\\n" "${prefix_title}" "${hosts_file_path}" "${prefix_reset}"
restore_HostsFile
cleanUp

return 0
}
4 changes: 0 additions & 4 deletions src/lib/revert.sh
Original file line number Diff line number Diff line change
@@ -48,8 +48,6 @@ revert_HostsFile()
errorCleanUp
exit 1
fi

return 0;
}


@@ -59,6 +57,4 @@ revert()
printf "%bReverting %s with %s ...%b\\n" "${prefix_title}" "${hosts_file_path}" "${hosts_file_previous_path}" "${prefix_reset}"
revert_HostsFile
cleanUp

return 0;
}
8 changes: 0 additions & 8 deletions src/lib/setup.sh
Original file line number Diff line number Diff line change
@@ -37,8 +37,6 @@ setup_BackupHostsFile()
else
echo "${prefix}Backup already exist, no need to backup."
fi

return 0
}


@@ -60,8 +58,6 @@ setup_Prompt()
exit 130
;;
esac

return 0
}


@@ -85,8 +81,6 @@ setup_PromptScheduler()
echo "${prefix}Skipping scheduler creation ..."
;;
esac

return 0
}


@@ -97,6 +91,4 @@ setup()
setup_Prompt
setup_BackupHostsFile
setup_PromptScheduler

return 0
}
30 changes: 0 additions & 30 deletions src/lib/update.sh
Original file line number Diff line number Diff line change
@@ -66,8 +66,6 @@ update_CheckBackupExist()
;;
esac
fi

return 0
}


@@ -82,8 +80,6 @@ update_CreateTmpDir()
rm -rf "${tmp_dir_path}"
mkdir "${tmp_dir_path}"
fi

return 0
}


@@ -113,8 +109,6 @@ update_ReadSourceList()
fi

fi

return 0
}


@@ -132,8 +126,6 @@ update_ReadWhiteList()
update_FilterDomains "whitelist" "whitelist-filtered"
update_SortDomains "whitelist-filtered" "whitelist-sorted"
fi

return 0
}


@@ -151,8 +143,6 @@ update_ReadBlackList()
update_FilterDomains "blacklist" "blacklist-filtered"
update_SortDomains "blacklist-filtered" "blacklist-sorted"
fi

return 0
}


@@ -219,8 +209,6 @@ update_FetchSources()
# Unset temporary function variables.
unset _total_count
unset _successful_count

return 0
}


@@ -247,8 +235,6 @@ update_FilterDomains()

unset _input_file
unset _output_file

return 0
}


@@ -262,8 +248,6 @@ update_SortDomains()

unset _input_file
unset _output_file

return 0
}


@@ -295,8 +279,6 @@ update_ApplyWhiteList()
cp "${tmp_dir_path}/applied-whitelist" "${tmp_dir_path}/cache"
fi


return 0
}


@@ -315,8 +297,6 @@ update_MergeBlackList()

cp "${tmp_dir_path}/merged-blacklist-sorted" "${tmp_dir_path}/cache"
fi

return 0
}


@@ -327,8 +307,6 @@ update_IsCacheEmpty()
cleanUp
exit 1
fi

return 0
}


@@ -366,8 +344,6 @@ update_BuildHostsFile()
| sed "s|#@hosts_file_backup_path@#|${hosts_file_backup_path}|g"

} > "${tmp_dir_path}/hosts"

return 0
}


@@ -388,8 +364,6 @@ update_PreviousHostsFile()
echo >> "${hosts_file_previous_path}"
echo "## This was the hosts file before $(date +'%b %e %X')" >> "${hosts_file_previous_path}"
fi

return 0;
}


@@ -406,8 +380,6 @@ update_ApplyHostsFile()
}

printf "%bSuccessfully applied new hosts file with %d blocked domains.%b\\n" "${prefix_info}" "$(wc -l < "${tmp_dir_path}/cache")" "${prefix_reset}"

return 0
}


@@ -457,6 +429,4 @@ update()
update_PreviousHostsFile
update_ApplyHostsFile
cleanUp

return 0
}

0 comments on commit 0683be2

Please sign in to comment.