Skip to content

Commit

Permalink
first run with gcc14 (#18)
Browse files Browse the repository at this point in the history
* first run with gcc14

* removed _ALLOC_ definition

* updated RCS logs

* updated ChangeLog
  • Loading branch information
mbhangui authored Jan 21, 2025
1 parent 9e53b6a commit 027dad5
Show file tree
Hide file tree
Showing 43 changed files with 282 additions and 167 deletions.
11 changes: 3 additions & 8 deletions base/alloc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: alloc.h,v $
* Revision 1.6 2025-01-21 22:18:20+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.5 2024-05-12 00:10:20+05:30 mbhangui
* fix function prototypes
*
Expand All @@ -19,14 +22,6 @@
/* @null@ *//* @out@ */
void *alloc(unsigned int);
void alloc_free(char *);
#ifdef _ALLOC_
#ifdef __APPLE__
int alloc_re(void **, unsigned int, unsigned int);
#else
int alloc_re();
#endif
#else
int alloc_re(void *, unsigned int, unsigned int);
#endif

#endif
7 changes: 4 additions & 3 deletions base/alloc_re.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: alloc_re.c,v $
* Revision 1.10 2025-01-21 22:18:34+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.9 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand All @@ -22,9 +25,7 @@
* added RCS log
*
*/
#define _ALLOC_
#include "alloc.h"
#undef _ALLOC_
#include "byte.h"

int
Expand All @@ -46,7 +47,7 @@ alloc_re(void **x, unsigned int old_size, unsigned int new_size)
void
getversion_alloc_re_c()
{
const char *x = "$Id: alloc_re.c,v 1.9 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: alloc_re.c,v 1.10 2025-01-21 22:18:34+05:30 Cprogrammer Exp mbhangui $";

x++;
}
9 changes: 6 additions & 3 deletions base/allwrite.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* $Id: allwrite.c,v 1.2 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $
* $Id: allwrite.c,v 1.3 2025-01-21 22:18:44+05:30 Cprogrammer Exp mbhangui $
*/
#include <unistd.h>
#include <sys/types.h>
#include "error.h"

ssize_t
allwrite(int fd, char *buf, size_t len)
allwrite(int fd, const char *buf, size_t len)
{
ssize_t w;
size_t total = 0;
Expand All @@ -29,13 +29,16 @@ allwrite(int fd, char *buf, size_t len)
void
getversion_allwrite_c()
{
const char *x = "$Id: allwrite.c,v 1.2 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: allwrite.c,v 1.3 2025-01-21 22:18:44+05:30 Cprogrammer Exp mbhangui $";

x++;
}

/*
* $Log: allwrite.c,v $
* Revision 1.3 2025-01-21 22:18:44+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.2 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand Down
5 changes: 4 additions & 1 deletion base/allwrite.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: allwrite.h,v $
* Revision 1.2 2025-01-21 22:18:48+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.1 2023-01-02 19:47:23+05:30 Cprogrammer
* Initial revision
*
Expand All @@ -8,5 +11,5 @@
#define _ALLWRITE_H
#include <sys/types.h>

ssize_t allwrite(int, char *, size_t);
ssize_t allwrite(int, const char *, size_t);
#endif
21 changes: 12 additions & 9 deletions base/buffer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: buffer.c,v 1.2 2024-05-12 00:10:20+05:30 mbhangui Exp mbhangui $
* $Id: buffer.c,v 1.3 2025-01-21 22:18:54+05:30 Cprogrammer Exp mbhangui $
*/
#include <unistd.h>
#include <errno.h>
Expand All @@ -12,7 +12,7 @@
*/

void
buffer_init(buffer *s, ssize_t(*op) (), int fd, char *buf, size_t len)
buffer_init(buffer *s, ssize_t(*op) (int, char *, size_t), int fd, char *buf, size_t len)
{
s->x = buf;
s->fd = fd;
Expand All @@ -33,8 +33,8 @@ char buffer_0_space[BUFFER_INSIZE];
char buffer_1_space[BUFFER_OUTSIZE];
char buffer_2_space[BUFFER_OUTSIZE];
static buffer it0 = BUFFER_INIT(buffer_0_read, 0, buffer_0_space, sizeof (buffer_0_space));
static buffer it1 = BUFFER_INIT(write, 1, buffer_1_space, sizeof (buffer_1_space));
static buffer it2 = BUFFER_INIT(write, 2, buffer_2_space, sizeof (buffer_2_space));
static buffer it1 = BUFFER_INIT((ssize_t (*)(int, char *, size_t)) write, 1, buffer_1_space, sizeof (buffer_1_space));
static buffer it2 = BUFFER_INIT((ssize_t (*)(int, char *, size_t)) write, 2, buffer_2_space, sizeof (buffer_2_space));

buffer *buffer_0 = &it0;
buffer *buffer_1 = &it1;
Expand All @@ -45,8 +45,8 @@ char buffer_1_small[BUFFER_SMALL];
char buffer_2_small[BUFFER_SMALL];

static buffer is0 = BUFFER_INIT(buffer_0_read, 0, buffer_0_small, sizeof (buffer_0_small));
static buffer is1 = BUFFER_INIT(write, 1, buffer_1_small, sizeof (buffer_1_small));
static buffer is2 = BUFFER_INIT(write, 2, buffer_2_small, sizeof (buffer_2_small));
static buffer is1 = BUFFER_INIT((ssize_t (*)(int, char *, size_t)) write, 1, buffer_1_small, sizeof (buffer_1_small));
static buffer is2 = BUFFER_INIT((ssize_t (*)(int, char *, size_t)) write, 2, buffer_2_small, sizeof (buffer_2_small));

buffer *buffer_0small = &is0;
buffer *buffer_1small = &is1;
Expand Down Expand Up @@ -198,7 +198,7 @@ buffer_flush(buffer *s)
if (!(p = s->p))
return 0;
s->p = 0;
return allwrite(s->op, s->fd, s->x, p);
return allwrite((ssize_t (*)(int, const char *, size_t)) s->op, s->fd, s->x, p);
}

int
Expand Down Expand Up @@ -235,7 +235,7 @@ buffer_put(buffer *s, const char *buf, size_t len)
while (len > s->n) {
if (n > len)
n = len;
if (allwrite(s->op, s->fd, buf, n) == -1)
if (allwrite((ssize_t (*)(int, const char *, size_t)) s->op, s->fd, buf, n) == -1)
return -1;
buf += n;
len -= n;
Expand All @@ -252,7 +252,7 @@ buffer_putflush(buffer *s, const char *buf, size_t len)
{
if (buffer_flush(s) == -1)
return -1;
return allwrite(s->op, s->fd, buf, len);
return allwrite((ssize_t (*)(int, const char *, size_t)) s->op, s->fd, buf, len);
}

int
Expand All @@ -275,6 +275,9 @@ buffer_putsflush(buffer *s, const char *buf)

/*
* $Log: buffer.c,v $
* Revision 1.3 2025-01-21 22:18:54+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.2 2024-05-12 00:10:20+05:30 mbhangui
* fix function prototypes
*
Expand Down
8 changes: 4 additions & 4 deletions base/buffer.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* $Id: buffer.h,v 1.2 2024-05-12 00:10:20+05:30 mbhangui Exp mbhangui $
* $Id: buffer.h,v 1.3 2025-01-21 22:18:59+05:30 Cprogrammer Exp mbhangui $
*/

#ifndef BUFFER_H
#define BUFFER_H
#include <sys/types.h> /* need type: ssize_t */
#include <sys/types.h> /* need type: ssize_t */

typedef struct buffer {
char *x;
unsigned int p;
size_t n;
int fd;
ssize_t(*op) ();
ssize_t (*op) (int, char *, size_t);
} buffer;

#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
#define BUFFER_SMALL 256
#define BUFFER_INSIZE 8192
#define BUFFER_OUTSIZE 8192

extern void buffer_init(buffer *, ssize_t(*op) (), int, char *, size_t);
extern void buffer_init(buffer *, ssize_t(*op) (int, char *, size_t), int, char *, size_t);
extern int buffer_flush(buffer *);
extern void buffer_discard(buffer *);
extern int buffer_put(buffer *, const char *, size_t);
Expand Down
7 changes: 5 additions & 2 deletions base/cdb_make.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: cdb_make.c,v $
* Revision 1.4 2025-01-21 22:19:04+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.3 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand Down Expand Up @@ -27,7 +30,7 @@ cdb_make_start(struct cdb_make *c, int fd)
c->numentries = 0;
c->fd = fd;
c->pos = sizeof c->final;
substdio_fdbuf(&c->b, write, fd, c->bspace, sizeof c->bspace);
substdio_fdbuf(&c->b, (ssize_t (*)(int, char *, size_t)) write, fd, c->bspace, sizeof c->bspace);
return seek_set(fd, c->pos);
}

Expand Down Expand Up @@ -197,7 +200,7 @@ cdb_make_finish(struct cdb_make *c)
void
getversion_cdb_make_c()
{
const char *x = "$Id: cdb_make.c,v 1.3 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: cdb_make.c,v 1.4 2025-01-21 22:19:04+05:30 Cprogrammer Exp mbhangui $";

x++;
}
7 changes: 5 additions & 2 deletions base/cdbmake.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: cdbmake.h,v $
* Revision 1.5 2025-01-21 22:19:08+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.4 2020-12-02 14:51:07+05:30 Cprogrammer
* changed return type of alloc() to void *
*
Expand Down Expand Up @@ -45,8 +48,8 @@ struct cdbmake
void cdbmake_pack(unsigned char *, uint32);
uint32 cdbmake_hashadd(uint32, unsigned int);
void cdbmake_init(struct cdbmake *);
int cdbmake_add(struct cdbmake *, uint32, uint32, void *(*alloc)());
int cdbmake_split(struct cdbmake *, void *(*alloc)());
int cdbmake_add(struct cdbmake *, uint32, uint32, void *(*alloc)(unsigned int));
int cdbmake_split(struct cdbmake *, void *(*alloc)(unsigned int));
uint32 cdbmake_throw(struct cdbmake *, uint32, int);

#endif
7 changes: 5 additions & 2 deletions base/cdbmss.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: cdbmss.c,v $
* Revision 1.8 2025-01-21 22:19:11+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.7 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand Down Expand Up @@ -30,7 +33,7 @@ cdbmss_start(struct cdbmss *c, int fd)
cdbmake_init(&c->cdbm);
c->fd = fd;
c->pos = sizeof(c->cdbm.final);
substdio_fdbuf(&c->ss, write, fd, c->ssbuf, sizeof(c->ssbuf));
substdio_fdbuf(&c->ss, (ssize_t (*)(int, char *, size_t)) write, fd, c->ssbuf, sizeof(c->ssbuf));
return seek_set(fd, (seek_pos) c->pos);
}

Expand Down Expand Up @@ -85,7 +88,7 @@ cdbmss_finish(struct cdbmss *c)
void
getversion_cdbmss_c()
{
const char *x = "$Id: cdbmss.c,v 1.7 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: cdbmss.c,v 1.8 2025-01-21 22:19:11+05:30 Cprogrammer Exp mbhangui $";

x++;
}
7 changes: 5 additions & 2 deletions base/env.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: env.c,v $
* Revision 1.12 2025-01-21 22:19:14+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.11 2024-05-12 00:10:20+05:30 mbhangui
* fix function prototypes
*
Expand Down Expand Up @@ -115,7 +118,7 @@ env_add(const char *s)
* no overflow check for en +1 as it would have succeeded in an
* earlier call to alloc()
*/
if (!alloc_re((char *) &environ, (en + 1) * sizeof(char *), i * sizeof(char *))) {
if (!alloc_re((void **) &environ, (en + 1) * sizeof(char *), i * sizeof(char *))) {
ea = en;
return 0;
}
Expand Down Expand Up @@ -233,7 +236,7 @@ restore_env()
void
getversion_env_c()
{
const char *x = "$Id: env.c,v 1.11 2024-05-12 00:10:20+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: env.c,v 1.12 2025-01-21 22:19:14+05:30 Cprogrammer Exp mbhangui $";

x++;
}
11 changes: 7 additions & 4 deletions base/envdir.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: envdir.c,v 1.16 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $
* $Id: envdir.c,v 1.17 2025-01-21 22:19:20+05:30 Cprogrammer Exp mbhangui $
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
Expand Down Expand Up @@ -62,7 +62,7 @@ if_visited(ino_t inum)
if (ino_ptr[i] == inum)
return 1;
}
if (!alloc_re(&ino_ptr, sizeof(ino_t) * ino_count, sizeof(ino_t) * (ino_count + 1)))
if (!alloc_re((void **) &ino_ptr, sizeof(ino_t) * ino_count, sizeof(ino_t) * (ino_count + 1)))
return -6; /*- out of memory */
} else {
if (!(ino_ptr = (ino_t *) alloc(sizeof(ino_t) * (ino_count + 1))))
Expand Down Expand Up @@ -302,7 +302,7 @@ envdir(const char *fn, const char **e, int ignore_unreadable, int *unreadable)
}
if (dt->d_name[0] == '.')
continue;
if (!alloc_re(&d, alen, len + str_len(dt->d_name) + 2)) {
if (!alloc_re((void **) &d, alen, len + str_len(dt->d_name) + 2)) {
if (e)
*e = error_str(errno);
exit_nicely(d, dir);
Expand Down Expand Up @@ -367,13 +367,16 @@ envdir(const char *fn, const char **e, int ignore_unreadable, int *unreadable)
void
getversion_envdir_c()
{
const char *x = "$Id: envdir.c,v 1.16 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: envdir.c,v 1.17 2025-01-21 22:19:20+05:30 Cprogrammer Exp mbhangui $";

x++;
}

/*
* $Log: envdir.c,v $
* Revision 1.17 2025-01-21 22:19:20+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.16 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand Down
7 changes: 5 additions & 2 deletions base/estack.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: estack.c,v $
* Revision 1.3 2025-01-21 22:19:24+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.2 2024-05-09 23:46:19+05:30 mbhangui
* fix discarded-qualifier compiler warnings
*
Expand Down Expand Up @@ -41,7 +44,7 @@ estack(int fderr, const char *errorstr)
substdio sserr;

if (fderr > -1)
substdio_fdbuf(&sserr, write, fderr, sserrbuf, sizeof(sserrbuf));
substdio_fdbuf(&sserr, (ssize_t (*)(int, char *, size_t)) write, fderr, sserrbuf, sizeof(sserrbuf));
if (errorstr && *errorstr) {
len = str_len((char *) errorstr) + 1; /* string + 1 null byte */
if (!(error_store = realloc(error_store, mylen + len + 1))) { /*- The man page is wierd on Mac OS */
Expand Down Expand Up @@ -94,6 +97,6 @@ estack(int fderr, const char *errorstr)
void
getversion_estack_qc()
{
const char *x = "$Id: estack.c,v 1.2 2024-05-09 23:46:19+05:30 mbhangui Exp mbhangui $";
const char *x = "$Id: estack.c,v 1.3 2025-01-21 22:19:24+05:30 Cprogrammer Exp mbhangui $";
x++; /*- No dollar for OSS/FS */
}
5 changes: 4 additions & 1 deletion base/gen_allocdefs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/*
* $Log: gen_allocdefs.h,v $
* Revision 1.7 2025-01-21 22:19:27+05:30 Cprogrammer
* fixes for gcc14
*
* Revision 1.6 2020-11-23 17:53:14+05:30 Cprogrammer
* fixed compiler warning
*
Expand Down Expand Up @@ -37,7 +40,7 @@ static int ta_rplus ## _internal (ta *x, unsigned int n, unsigned int pluslen) \
if (__builtin_mul_overflow(nnum, sizeof(type), &nlen)) { \
errno = error_nomem; \
return 0; } \
if (!alloc_re((char *) &x->field,x->a * sizeof(type),nlen)) { \
if (!alloc_re((void **) &x->field,x->a * sizeof(type),nlen)) { \
errno = error_nomem; \
return 0; } \
x->a = nnum; \
Expand Down
Loading

0 comments on commit 027dad5

Please sign in to comment.