remove compiler warnings in ent
try to fix io_waituntil2 on freebsd
This commit is contained in:
parent
dc69bc24ec
commit
bbaf63c7fd
12
ent.c
12
ent.c
@ -5,6 +5,7 @@
|
||||
#include "scan.h"
|
||||
#include <assert.h>
|
||||
|
||||
#define INTERNAL
|
||||
#include "scan/scan_ulong.c"
|
||||
#include "scan/scan_ulongn.c"
|
||||
#include "fmt/fmt_utf8.c"
|
||||
@ -23,7 +24,7 @@ struct entity {
|
||||
}* root,** cur=&root;
|
||||
|
||||
struct letter {
|
||||
char c;
|
||||
unsigned char c;
|
||||
struct letters* weiter;
|
||||
uint32_t marshaled; // lower 8 bits: char. rest: ofs from start of marshaled blob
|
||||
};
|
||||
@ -126,14 +127,14 @@ void marshalhelper(struct letters* s) {
|
||||
}
|
||||
|
||||
void marshal(struct letters* s) {
|
||||
fprintf(stderr,"nodes=%lu, datasize=%lu\n",nodes,datasize);
|
||||
fprintf(stderr,"nodes=%zu, datasize=%zu\n",nodes,datasize);
|
||||
heap=malloc((nodes+1)*sizeof(uint32_t)+datasize);
|
||||
if (!heap) nomem();
|
||||
marshaled=(uint32_t*)heap;
|
||||
marshaled[0]=nodes+1;
|
||||
data=heap+(nodes+1)*sizeof(uint32_t);
|
||||
marshalhelper(s);
|
||||
fprintf(stderr,"actually used: %lu nodes, %lu bytes data\n",used,useddata);
|
||||
fprintf(stderr,"actually used: %zu nodes, %zu bytes data\n",used,useddata);
|
||||
}
|
||||
|
||||
char* lookup(char* ds,size_t ofs,const char* t) {
|
||||
@ -168,7 +169,8 @@ int main() {
|
||||
if (!(*s=='"')) continue;
|
||||
++s;
|
||||
entity=s;
|
||||
if (*entity!='&') continue; ++entity; ++s;
|
||||
if (*entity!='&') continue;
|
||||
++entity; ++s;
|
||||
for (; *s && *s!='"'; ++s) ; // skip to end of entity
|
||||
if (!(*s=='"')) continue;
|
||||
if (s[-1]!=';') continue;
|
||||
@ -216,7 +218,7 @@ int main() {
|
||||
{
|
||||
FILE* f=fopen("entities.h","w");
|
||||
size_t i;
|
||||
fprintf(f,"struct {\n uint32_t tab[%u];\n char data[%lu];\n} entities = {\n {",marshaled[0],datasize);
|
||||
fprintf(f,"struct {\n uint32_t tab[%u];\n char data[%zu];\n} entities = {\n {",marshaled[0],datasize);
|
||||
for (i=0; i<marshaled[0]; ++i) {
|
||||
if (i%8 == 0) fprintf(f,"\n ");
|
||||
fprintf(f,"0x%x,",marshaled[i]);
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#ifndef EPOLLRDNORM
|
||||
@ -132,7 +133,13 @@ int64 io_waituntil2(int64 milliseconds) {
|
||||
first_deferred=-1; // can't happen
|
||||
}
|
||||
}
|
||||
/* if no interest in events has been registered, then return
|
||||
* immediately */
|
||||
if (!io_wanted_fds) return 0;
|
||||
|
||||
/* only actually wait if all previous events have been dequeued */
|
||||
if (first_readable!=-1 || first_writeable!=-1) return 0;
|
||||
|
||||
#ifdef HAVE_EPOLL
|
||||
if (io_waitmode==EPOLL) {
|
||||
int n;
|
||||
@ -261,11 +268,17 @@ int64 io_waituntil2(int64 milliseconds) {
|
||||
}
|
||||
if (!e->canread && (y[n].filter==EVFILT_READ)) {
|
||||
e->canread=1;
|
||||
#ifdef DEBUG
|
||||
assert(e->next_read==-1);
|
||||
#endif
|
||||
e->next_read=first_readable;
|
||||
first_readable=y[n].ident;
|
||||
}
|
||||
if (!e->canwrite && (y[n].filter==EVFILT_WRITE)) {
|
||||
if ((y[n].filter==EVFILT_WRITE)) {
|
||||
e->canwrite=1;
|
||||
#ifdef DEBUG
|
||||
assert(e->next_write==-1);
|
||||
#endif
|
||||
e->next_write=first_writeable;
|
||||
first_writeable=y[i].ident;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "scan.h"
|
||||
#ifndef INTERNAL
|
||||
#include "haveuint128.h"
|
||||
#endif
|
||||
|
||||
size_t scan_ulongn(const char* src,size_t n,unsigned long int* dest) {
|
||||
register const char *tmp=src;
|
||||
|
Loading…
x
Reference in New Issue
Block a user