Skip to content

Commit d64b9ce

Browse files
authored
patch: tidy object data (briandfoy#945)
* The original options hash from the Patch object is blessed again as Patch::Context (or other subclass) * Storing the same data again in $self->{options} is not useful, and $self->{options} was not being accessed * The comment about $self->{o_pos} indicates it's also dead code, and I don't see any references to it * As a regression test I processed a "normal" diff with "perl patch -n a.file a.diff"
1 parent 493a57e commit d64b9ce

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

bin/patch

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,9 @@ sub bless {
357357
{};
358358
bless $self, $class;
359359

360-
# 'options' and 'garbage' are probably better off as class
361-
# data. Why didn't I do that before? But it's not broken
362-
# so I'm not fixing it.
363-
$self->{options} = $options; # @options
360+
# Item 'garbage' is probably better off as class data
364361
$self->{garbage} = []; # garbage lines
365362
$self->{i_pos} = 0; # current position in 'in' file
366-
$self->{o_pos} = 0; # just for symmetry
367363
$self->{i_lines} = 0; # lines read in 'in' file
368364
$self->{o_lines} = 0; # lines written to 'out' file
369365
$self->{hunk} = 1; # current hunk number

0 commit comments

Comments
 (0)