This file is indexed.

/usr/lib/perl5/KinoSearch1/Util/StringHelper.pm is in libkinosearch1-perl 1.00-1build3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package KinoSearch1::Util::StringHelper;

1;

__END__

__H__

#ifndef H_KINO_STRING_HELPER
#define H_KINO_STRING_HELPER 1

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "KinoSearch1UtilCarp.h"

I32 Kino1_StrHelp_string_diff(char*, char*, STRLEN, STRLEN);
I32 Kino1_StrHelp_compare_strings(char*, char*, STRLEN, STRLEN);
I32 Kino1_StrHelp_compare_svs(SV*, SV*);

#endif /* include guard */

__C__

#include "KinoSearch1UtilStringHelper.h"

/* return the number of bytes that two strings have in common */

I32
Kino1_StrHelp_string_diff(char *str1, char *str2, STRLEN len1, STRLEN len2) {
    STRLEN i, len;

    len = len1 <= len2 ? len1 : len2;

    for (i = 0; i < len; i++) {
        if (*str1++ != *str2++) 
            break;
    }
    return i;
}

/* memcmp, but with lengths for both pointers, not just one */
I32
Kino1_StrHelp_compare_strings(char *a, char *b, STRLEN a_len, STRLEN b_len) {
    STRLEN len;
    I32 comparison = 0;

    if (a == NULL  || b == NULL)
        Kino1_confess("Internal error: can't compare unallocated pointers");
    
    len = a_len < b_len? a_len : b_len;
    if (len > 0)
        comparison = memcmp(a, b, len);

    /* if a is a substring of b, it's less than b, so return a neg num */
    if (comparison == 0) 
        comparison = a_len - b_len;

    return comparison;
}

/* compare the PVs of two scalars */
I32
Kino1_StrHelp_compare_svs(SV *sva, SV *svb) {
    char   *a, *b;
    STRLEN  a_len, b_len;

    a = SvPV(sva, a_len);
    b = SvPV(svb, b_len);

    return Kino1_StrHelp_compare_strings(a, b, a_len, b_len);
}

__POD__

=begin devdocs

=head1 NAME

KinoSearch1::Util::StringHelper - String related utilities

=head1 DESCRIPTION

String related utilities, e.g. string comparison functions.

=head1 COPYRIGHT

Copyright 2005-2010 Marvin Humphrey

=head1 LICENSE, DISCLAIMER, BUGS etc.

See L<KinoSearch1> version 1.00.

=end devdocs
=cut