Skip to content

Commit 8c652f6

Browse files
committed
optimized
1 parent 0899e9e commit 8c652f6

21 files changed

+67
-49
lines changed

.github/workflows/alpinelinux.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: alpinelinux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
alpinelinux:

.github/workflows/archlinux.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: archlinux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
archlinux:

.github/workflows/centos.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CentOS Linux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
centos8:

.github/workflows/codacy-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: codacy-analysis
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
codacy-analysis:

.github/workflows/debian.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Debian GNU/Linux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
test:

.github/workflows/fedora.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Fedora
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
test:

.github/workflows/freebsd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: FreeBSD
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
freebsd:

.github/workflows/gentoo.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: gentoo
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
gentoo:

.github/workflows/linuxmint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: LinuxMint
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
test:

.github/workflows/macos.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: macos
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010

.github/workflows/manjaro.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Manjaro Linux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
test:

.github/workflows/netbsd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: NetBSD
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
netbsd:

.github/workflows/openbsd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: OpenBSD
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
openbsd:

.github/workflows/opensuse.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: openSUSE
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
opensuse:

.github/workflows/ppkg.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: ppkg
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
ppkg:

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
with:
17-
ref: 0.15.2
17+
ref: 0.15.3
1818

1919
- id: check-if-has-new-commit
2020
run: |

.github/workflows/ubuntu.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: ubuntu
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
vcpkg:

.github/workflows/valgrind.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: valgrind
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
valgrind:

.github/workflows/voidlinux.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: voidlinux
22

33
on:
44
push:
5-
branches: [ 0.15.2 ]
5+
branches: [ 0.15.3 ]
66
pull_request:
7-
branches: [ 0.15.2 ]
7+
branches: [ 0.15.3 ]
88

99
jobs:
1010
voidlinux:

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.0)
22

33
project(uppm C)
44

5-
set(PROJECT_VERSION 0.15.2)
5+
set(PROJECT_VERSION 0.15.3)
66
set(PROJECT_VERSION_MAJOR 0)
77
set(PROJECT_VERSION_MINOR 15)
8-
set(PROJECT_VERSION_PATCH 2)
8+
set(PROJECT_VERSION_PATCH 3)
99

1010
set(CMAKE_C_STANDARD 99)
1111
set(CMAKE_C_STANDARD_REQUIRED ON)

src/core/tar.c

+28-10
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ int tar_list(const char * inputFilePath, int flags) {
4444

4545
finalize:
4646
if (ret != ARCHIVE_OK) {
47-
fprintf(stdout, "%s\n", archive_error_string(ar));
47+
const char * errorMessage = archive_error_string(ar);
48+
49+
if (errorMessage == NULL || errorMessage[0] == '\0') {
50+
fprintf(stderr, "unknown error.\n");
51+
} else {
52+
fprintf(stderr, "%s\n", errorMessage);
53+
}
4854
}
4955

5056
archive_read_close(ar);
@@ -97,11 +103,9 @@ int tar_extract(const char * outputDir, const char * inputFilePath, int flags, b
97103
const char * entry_pathname = archive_entry_pathname(entry);
98104

99105
if (stripComponentsNumber > 0U) {
100-
size_t entry_pathname_length = strlen(entry_pathname);
101-
102-
for (size_t i = 0; i < entry_pathname_length; i++) {
106+
for (size_t i = 0; entry_pathname[i] != '\0'; i++) {
103107
if (entry_pathname[i] == '/') {
104-
entry_pathname = entry_pathname + i + 1U;
108+
entry_pathname += i + 1U;
105109
break;
106110
}
107111
}
@@ -131,10 +135,9 @@ int tar_extract(const char * outputDir, const char * inputFilePath, int flags, b
131135

132136
if (hardlinkname != NULL) {
133137
if (stripComponentsNumber > 0U) {
134-
size_t hardlinkname_length = strlen(hardlinkname);
135-
for (size_t i = 0; i < hardlinkname_length; i++) {
138+
for (size_t i = 0; hardlinkname[i] != '\0'; i++) {
136139
if (hardlinkname[i] == '/') {
137-
hardlinkname = hardlinkname + i + 1U;
140+
hardlinkname += i + 1U;
138141
break;
139142
}
140143
}
@@ -194,7 +197,15 @@ int tar_extract(const char * outputDir, const char * inputFilePath, int flags, b
194197

195198
finalize:
196199
if (ret != ARCHIVE_OK) {
197-
fprintf(stdout, "%s\n", archive_error_string(ar));
200+
const char * errorMessage = archive_error_string(ar);
201+
202+
if (errorMessage == NULL || errorMessage[0] == '\0') {
203+
fprintf(stderr, "unknown error.\n");
204+
} else {
205+
fprintf(stderr, "%s\n", errorMessage);
206+
}
207+
208+
fprintf(stderr, "%s\n", errorMessage);
198209
}
199210

200211
archive_read_close(ar);
@@ -427,7 +438,14 @@ int tar_create(const char * inputDir, const char * outputFilePath, ArchiveType t
427438

428439
finalize:
429440
if (ret != ARCHIVE_OK) {
430-
fprintf(stdout, "%s\n", archive_error_string(ar));
441+
const char * errorMessage = archive_error_string(ar);
442+
443+
if (errorMessage == NULL || errorMessage[0] == '\0') {
444+
fprintf(stderr, "unknown error.\n");
445+
} else {
446+
fprintf(stderr, "%s\n", errorMessage);
447+
}
448+
431449
archive_read_close(ar);
432450
archive_read_free(ar);
433451
}

0 commit comments

Comments
 (0)