add logging of PC92A ip addresses
[spider.git] / perl / RingBuf.pm
index e9b1052a92f8e42566b02b91aa608c6cd69c7116..8a2a836182925c49cc7674517636fd81508bace6 100644 (file)
@@ -3,19 +3,13 @@
 #
 # Copyright (c) - 1998 Dirk Koopman G1TLH
 #
-# $Id$
+#
 #
 
 use strict;
 
 package RingBuf;
 
-use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
-
 
 sub new
 {
@@ -28,7 +22,7 @@ sub new
        # 3 - start
        # 4 - pos
        # 5 - buffer []
-       return bless [$size, 0, 0, 0, 0, []], (ref $pkg || $pkg);
+       return bless [$size+1, 0, 0, 0, 0, []], (ref $pkg || $pkg);
 }
 
 sub write
@@ -37,10 +31,7 @@ sub write
 
        $self->[5]->[$self->[2]++] = shift;
        $self->[2] = 0 if $self->[2] >= $self->[0];
-       if ($self->[1] < $self->[0]) {
-               $self->[1] = ++$self->[1];
-       }
-       $self->[2] = $self->[2];
+       $self->[1]++ if $self->[1] < $self->[0];
        if ($self->[1] == $self->[0] && $self->[2] == $self->[3]) {
                $self->[3] = $self->[2]+1;
                $self->[3] = 0 if $self->[3] >= $self->[0];