Skip to content

Commit

Permalink
Supplement: Match fmem* functions to common prototypes
Browse files Browse the repository at this point in the history
Since ia16-elf-gcc's libi86 received support for fmemcpy, fmemmove
and fmemset, its prototypes are in conflict with the replacement
functions defined in the suppl directory. If libi86 implements all
of the support required for FreeCOM in the future, then we may not
need to include suppl, but until then adjust the suppl to match the
common prototypes.

Patch by @tkchia, and discussion at [fixes #79]
  • Loading branch information
andrewbird authored and PerditionC committed Aug 26, 2022
1 parent 7b7889c commit 83fd61d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions suppl/fmemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
#define _fmemset farmemset

#else /* !_PAC_NOCLIB_ */
void _fmemcpy(void far * const dst, const void far * const src, unsigned length);
void _fmemset(void far * const dst, int ch, unsigned length);
void far *_fmemcpy(void far * const dst, const void far * const src, unsigned length);
void far *_fmemset(void far * const dst, int ch, unsigned length);
#endif /* _PAC_NOCLIB_ */

unsigned _fstrlen(const char far * const s);
char far *_fstrchr(const char far * const s, int ch);
char far *_fmemchr(const char far * const s, int ch, unsigned length);
void _fmemmove(void far * const dst, const void far * const src, unsigned length);
void far *_fmemmove(void far * const dst, const void far * const src, unsigned length);
int _fmemcmp(const void far * const dst, const void far * const src, unsigned length);
int _fmemicmp(const void far * const dst, const void far * const src, unsigned length);
int _fstrcmp(const char far * const dst, const char far * const src);
Expand Down
3 changes: 2 additions & 1 deletion suppl/src/fmemcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void _fmemcpy(unsigned const dseg, unsigned const dofs
#include <portable.h>
#include "fmemory.h"

void _fmemcpy(void far * const s1, const void far * const s2, unsigned length)
void far *_fmemcpy(void far * const s1, const void far * const s2, unsigned length)
{ byte far*p;
const byte far*q;

Expand All @@ -68,6 +68,7 @@ void _fmemcpy(void far * const s1, const void far * const s2, unsigned length)
do *p++ = *q++;
while(--length);
}
return s1;
}

#endif
Expand Down
7 changes: 4 additions & 3 deletions suppl/src/fmemove.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ void _fmemmove(unsigned dseg, unsigned dofs
#include <portable.h>
#include "fmemory.h"

void _fmemmove(void far * const s1, const void far * const s2
void far *_fmemmove(void far * const s1, const void far * const s2
, unsigned length)
{ byte far *p;
byte far *q;
byte far *h;

if(!length)
return;
return s1;

p = _fnormalize(s1);
q = _fnormalize((void far*)s2);
Expand All @@ -117,7 +117,7 @@ void _fmemmove(void far * const s1, const void far * const s2
--> copy backwardly
*/
if(p == q)
return;
return s1;

/*
* without the typecasts TC++1 ignores the segment portions completely
Expand All @@ -136,6 +136,7 @@ void _fmemmove(void far * const s1, const void far * const s2
else {
_fmemcpy(s1, s2, length);
}
return s1;
}
#endif
#endif

0 comments on commit 83fd61d

Please sign in to comment.