summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-10-13 14:16:29 +0200
committerRemi Collet <remi@php.net>2023-10-13 14:16:29 +0200
commit6bf51c5b1d4250b28d8fd09e43504b482f6d8ed2 (patch)
treedf7b8b3385d189c796a20f1c5c56eb1151b50358
parent4e77dbaaa852b1e60f119e0dc1c175c7f333d925 (diff)
cleanup
-rw-r--r--rpminfo.c18
-rw-r--r--tests/014-stream.phpt12
2 files changed, 15 insertions, 15 deletions
diff --git a/rpminfo.c b/rpminfo.c
index d94ac72..adc7629 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -291,7 +291,7 @@ PHP_FUNCTION(rpmdbinfo)
db = rpminfo_getdb();
di = rpmdbInitIterator(db, RPMDBI_LABEL, name, len);
if (!di) {
- // Not found
+ /* Not found */
RETURN_NULL();
}
@@ -431,7 +431,7 @@ PHP_FUNCTION(rpmdbsearch)
}
}
if (!di) {
- // Not found
+ /* Not found */
RETURN_NULL();
}
@@ -463,7 +463,7 @@ PHP_FUNCTION(rpmvercmp)
evr1 = estrdup(in_evr1);
evr2 = estrdup(in_evr2);
- // Epoch
+ /* Epoch */
p = strchr(evr1, ':');
if (p) {
v1 = p+1;
@@ -487,7 +487,7 @@ PHP_FUNCTION(rpmvercmp)
} else if (e1 > e2) {
r = 1;
} else {
- // Version
+ /* Version */
p = strchr(v1, '-');
if (p) {
r1 = p+1;
@@ -504,7 +504,7 @@ PHP_FUNCTION(rpmvercmp)
}
r = rpmvercmp(v1, v2);
if (!r) {
- // Release
+ /* Release*/
r = rpmvercmp(r1, r2);
}
}
@@ -618,7 +618,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb)
STREAM_DATA_FROM_STREAM();
if (self) {
- struct stat s[2]; // librpm may use different size (32-bit)
+ struct stat s[2]; /* librpm may use different size (32-bit) */
int rc;
rc = rpmfiStat(self->fi, 0, s);
memcpy(&ssb->sb, s, sizeof(ssb->sb));
@@ -775,7 +775,7 @@ static int php_stream_rpm_stat(php_stream_wrapper *wrapper, const char *url, int
self = php_stream_rpm_finder(url, 0);
if (self) {
- struct stat s[2]; // librpm may use different size (32-bit)
+ struct stat s[2]; /* librpm may use different size (32-bit) */
rc = rpmfiStat(self->fi, 0, s);
memcpy(&ssb->sb, s, sizeof(ssb->sb));
php_rpm_ops_free(self, 1);
@@ -810,8 +810,8 @@ const php_stream_wrapper php_stream_rpm_wrapper = {
*/
PHP_MINIT_FUNCTION(rpminfo)
{
- const char *tagname;
- rpmtd names;
+ const char *tagname;
+ rpmtd names;
REGISTER_STRING_CONSTANT("RPMVERSION", (char *)RPMVERSION, CONST_CS | CONST_PERSISTENT);
diff --git a/tests/014-stream.phpt b/tests/014-stream.phpt
index f084326..37b41dd 100644
--- a/tests/014-stream.phpt
+++ b/tests/014-stream.phpt
@@ -9,6 +9,7 @@ if (version_compare(RPMVERSION, '4.13', 'lt')) print("skip librpm is older than
<?php
$d = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon";
$n = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/README";
+$x = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/MISSING";
$foo = "rpm://" . __DIR__ . "/bidon.rpm#/etc/foo.conf";
$bar = "rpm://" . __DIR__ . "/bidon.rpm#/etc/bar.conf";
@@ -34,11 +35,10 @@ var_dump(feof($f));
fclose($f);
echo "+ stream\n";
-var_dump(trim(file_get_contents($n)));
-var_dump(trim(file_get_contents($foo)));
-var_dump(trim(file_get_contents($bar)));
-
-var_dump(file_get_contents(str_replace('README', 'TODO', $n)));
+var_dump(trim(file_get_contents($n))); // Existing file
+var_dump(trim(file_get_contents($foo))); // Hardlink with content
+var_dump(trim(file_get_contents($bar))); // hardlink without content
+var_dump(file_get_contents($x)); // Missing file
?>
Done
--EXPECTF--
@@ -70,6 +70,6 @@ string(29) "Fri Oct 13 12:24:27 CEST 2023"
string(7) "content"
string(7) "content"
-Warning: file_get_contents(%s/bidon.rpm#/usr/share/doc/bidon/TODO): Failed to open stream: operation failed in %s on line %d
+Warning: file_get_contents(%s/bidon.rpm#/usr/share/doc/bidon/MISSING): Failed to open stream: operation failed in %s on line %d
bool(false)
Done