On Fri, Dec 07, 2018 at 06:59:01PM -0600, Jacob Bachmeyer wrote:
> + if { [string match "$pattern" $result] } {
> + return 1
> + } else {
> + return 0
> + }
This can be simplified to:
return [string match $pattern $result]
> + if { [regexp -- $regexp $result] } {
> + return 1
> + } else {
> + return 0
> + }
Likewise here for [regexp ...].
> + if { $result eq $val } {
> + return 1
> + } else {
> + return 0
> + }
This can be simplified to:
return [string equal $result $val]
> + if { $val } {
> + if { $result } { return 1 } else { return 0 }
> + } else {
> + if { $result } { return 0 } else { return 1 }
> + }
This could be simplified to:
if {$val} {
return [expr $result != 0]
} else {
return [expr $result == 0]
}
Cherrs,
Ben
signature.asc
Description: PGP signature
_______________________________________________ DejaGnu mailing list [email protected] https://lists.gnu.org/mailman/listinfo/dejagnu
