Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/forth/support.4th
Show First 20 Lines • Show All 925 Lines • ▼ Show 20 Lines | : show-module-options | ||||
begin | begin | ||||
?dup | ?dup | ||||
while | while | ||||
show-one-module | show-one-module | ||||
module.next @ | module.next @ | ||||
repeat | repeat | ||||
; | ; | ||||
: free-one-module { addr -- addr } | |||||
addr module.name strfree | |||||
addr module.loadname strfree | |||||
addr module.type strfree | |||||
addr module.args strfree | |||||
addr module.beforeload strfree | |||||
addr module.afterload strfree | |||||
addr module.loaderror strfree | |||||
addr | |||||
; | |||||
: free-module-options | |||||
module_options @ | |||||
begin | |||||
?dup | |||||
while | |||||
free-one-module | |||||
dup module.next @ | |||||
swap free-memory | |||||
repeat | |||||
0 module_options ! | |||||
0 last_module_option ! | |||||
; | |||||
only forth also support-functions definitions | only forth also support-functions definitions | ||||
\ Variables used for processing multiple conf files | \ Variables used for processing multiple conf files | ||||
string current_file_name_ref \ used to print the file name | string current_file_name_ref \ used to print the file name | ||||
\ Indicates if any conf file was succesfully read | \ Indicates if any conf file was succesfully read | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | while | ||||
current_file_name_ref strref | current_file_name_ref strref | ||||
['] load_conf catch | ['] load_conf catch | ||||
process_conf_errors | process_conf_errors | ||||
conf_files .addr @ if recurse then | conf_files .addr @ if recurse then | ||||
repeat | repeat | ||||
; | ; | ||||
: get_nextboot_conf_file ( -- addr len ) | : get_nextboot_conf_file ( -- addr len ) | ||||
nextboot_conf_file strget strdup | nextboot_conf_file strget strdup | ||||
tsoome: actually the comment on this line was correct one - this strdup does introduce memory leak, and… | |||||
Not Done Inline ActionsSorry for the confusion. This is an unrelated change that Phabricator is mis-identifying. I should have done a separate update to Phabricator when I rebased my tree on the latest -current This change is part of rS292899 and unrelated to the ZFS BE menu work. allanjude: Sorry for the confusion. This is an unrelated change that Phabricator is mis-identifying. I… | |||||
Done Inline ActionsYou're right. I fixed the actual leak in SVN r292999 dteske: You're right. I fixed the actual leak in SVN r292999 | |||||
; | ; | ||||
: rewrite_nextboot_file ( -- ) | : rewrite_nextboot_file ( -- ) | ||||
get_nextboot_conf_file | get_nextboot_conf_file | ||||
O_WRONLY fopen fd ! | O_WRONLY fopen fd ! | ||||
fd @ -1 = if EOPEN throw then | fd @ -1 = if EOPEN throw then | ||||
fd @ s' nextboot_enable="NO" ' fwrite ( fd buf len -- nwritten ) drop | fd @ s' nextboot_enable="NO" ' fwrite ( fd buf len -- nwritten ) drop | ||||
fd @ fclose | fd @ fclose | ||||
▲ Show 20 Lines • Show All 552 Lines • Show Last 20 Lines |
actually the comment on this line was correct one - this strdup does introduce memory leak, and it actually is unneeded, file name produced by this word will be consumed by fopen and therefore strget is just enough to produce addr len pair into the stack.