File: File.xs

package info (click to toggle)
libgit-raw-perl 0.87%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,464 kB
  • sloc: perl: 5,404; ansic: 182; makefile: 6
file content (77 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (4)
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
MODULE = Git::Raw::Diff			PACKAGE = Git::Raw::Diff::File

SV *
id(self)
	Diff_File self

	CODE:
		RETVAL = git_oid_to_sv(&self -> id);

	OUTPUT: RETVAL

SV *
path(self)
	Diff_File self

	CODE:
		RETVAL = newSVpv(self -> path, 0);

	OUTPUT: RETVAL

SV *
size(self)
	Diff_File self

	CODE:
		RETVAL = newSVuv((size_t) self -> size);

	OUTPUT: RETVAL

SV *
flags(self)
	Diff_File self

	PREINIT:
		AV *flags = newAV();

	CODE:
		if (self -> flags & GIT_DIFF_FLAG_BINARY)
			av_push(flags, newSVpv("binary", 0));
		if (self -> flags & GIT_DIFF_FLAG_VALID_ID)
			av_push(flags, newSVpv("valid_id", 0));

		RETVAL = newRV_noinc((SV *) flags);

	OUTPUT: RETVAL

SV *
mode(self)
	Diff_File self

	PREINIT:
		const char *mode = NULL;

	CODE:
		if (self -> mode == GIT_FILEMODE_UNREADABLE)
			mode = "unreadable";
		else if (self -> mode == GIT_FILEMODE_TREE)
			mode = "tree";
		else if (self -> mode == GIT_FILEMODE_BLOB)
			mode = "blob";
		else if (self -> mode == GIT_FILEMODE_BLOB_EXECUTABLE)
			mode = "blob_executable";
		else if (self -> mode == GIT_FILEMODE_LINK)
			mode = "link";
		else if (self -> mode == GIT_FILEMODE_COMMIT)
			mode = "commit";

		RETVAL = newSVpv (mode, 0);

	OUTPUT: RETVAL

void
DESTROY(self)
	SV *self

	CODE:
		SvREFCNT_dec(GIT_SV_TO_MAGIC(self));