/ Changes On Branch lemon-update-2010
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch lemon-update-2010 Excluding Merge-Ins

This is equivalent to a diff from 0354ab279f to 892c5f377a

2010-11-19
04:22
Lemon: Fixed compiler warning on Visual C++. (Closed-Leaf check-in: 892c5f377a user: icculus tags: lemon-update-2010)
04:19
Lemon: correcting previous win32 access() fix. The previous fix caused link errors when compiled as C++. (check-in: bd03d3331d user: icculus tags: lemon-update-2010)
2010-03-03
22:25
Modify the sqlite3_log() interface and implementation so that it never uses dynamic memory allocation - to avoid deadlocking when called while holding the memory allocator mutex. (check-in: 28d1bc98d6 user: drh tags: trunk)
16:54
Merged trunk to lemon-update-2010 branch. (check-in: 88b466bae4 user: icculus tags: lemon-update-2010)
16:02
Fix some extra instances of the constants addressed by [83e47ca006]. (check-in: 0354ab279f user: dan tags: trunk)
15:18
Factor out constant expressions in sqlite3GetVarint() to work around nuisance warning messages from the RVT compiler. (check-in: 83e47ca006 user: drh tags: trunk)

Changes to tool/lemon.c.

16
17
18
19
20
21
22



23



24
25
26
27
28
29
30
#ifndef __WIN32__
#   if defined(_WIN32) || defined(WIN32)
#	define __WIN32__
#   endif
#endif

#ifdef __WIN32__



extern int access();



#else
#include <unistd.h>
#endif

/* #define PRIVATE static */
#define PRIVATE








>
>
>
|
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef __WIN32__
#   if defined(_WIN32) || defined(WIN32)
#	define __WIN32__
#   endif
#endif

#ifdef __WIN32__
#ifdef __cplusplus
extern "C" {
#endif
extern int access(const char *path, int mode);
#ifdef __cplusplus
}
#endif
#else
#include <unistd.h>
#endif

/* #define PRIVATE static */
#define PRIVATE

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
    /* if we failed, delete (most) files we made, to unconfuse build tools. */
    int i;
    for (i = 0; i < made_files_count; i++) {
        if (!successful_exit) {
            remove(made_files[i]);
        }
        free((void *) made_files[i]);
    }
    free(made_files);
    made_files_count = 0;
    made_files = NULL;
}

static char *msort(char*,char**,int(*)(const char*,const char*));







<







47
48
49
50
51
52
53

54
55
56
57
58
59
60
{
    /* if we failed, delete (most) files we made, to unconfuse build tools. */
    int i;
    for (i = 0; i < made_files_count; i++) {
        if (!successful_exit) {
            remove(made_files[i]);
        }

    }
    free(made_files);
    made_files_count = 0;
    made_files = NULL;
}

static char *msort(char*,char**,int(*)(const char*,const char*));
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
  if( rc==0 ){
    rc = (int)ap1->type - (int)ap2->type;
  }
  if( rc==0 && ap1->type==REDUCE ){
    rc = ap1->x.rp->index - ap2->x.rp->index;
  }
  if( rc==0 ){
    rc = ap2 - ap1;
  }
  return rc;
}

/* Sort parser actions */
static struct action *Action_sort(
  struct action *ap







|







400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
  if( rc==0 ){
    rc = (int)ap1->type - (int)ap2->type;
  }
  if( rc==0 && ap1->type==REDUCE ){
    rc = ap1->x.rp->index - ap2->x.rp->index;
  }
  if( rc==0 ){
    rc = (int) (ap2 - ap1);
  }
  return rc;
}

/* Sort parser actions */
static struct action *Action_sort(
  struct action *ap
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
  ** is to keep makefiles from getting confused. We don't include .out files,
  ** though: this is debug information, and you don't want it deleted if there
  ** was an error you need to track down.
  */
  if(( *mode=='w' ) && (strcmp(suffix, ".out") != 0)){
    const char **ptr = (const char **)
        realloc(made_files, sizeof (const char **) * (made_files_count + 1));
    char *fname = strdup(lemp->outname);
    if ((ptr == NULL) || (fname == NULL)) {
        free(ptr);
        free(fname);
        memory_error();
    }
    made_files = ptr;
    made_files[made_files_count++] = fname;
  }
  return fp;
}







|


<







2760
2761
2762
2763
2764
2765
2766
2767
2768
2769

2770
2771
2772
2773
2774
2775
2776
  ** is to keep makefiles from getting confused. We don't include .out files,
  ** though: this is debug information, and you don't want it deleted if there
  ** was an error you need to track down.
  */
  if(( *mode=='w' ) && (strcmp(suffix, ".out") != 0)){
    const char **ptr = (const char **)
        realloc(made_files, sizeof (const char **) * (made_files_count + 1));
    const char *fname = Strsafe(lemp->outname);
    if ((ptr == NULL) || (fname == NULL)) {
        free(ptr);

        memory_error();
    }
    made_files = ptr;
    made_files[made_files_count++] = fname;
  }
  return fp;
}
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
  if( n<=0 ){
    if( n<0 ){
      used += n;
      assert( used>=0 );
    }
    n = lemonStrlen(zText);
  }
  if( n+sizeof(zInt)*2+used >= alloced ){
    alloced = n + sizeof(zInt)*2 + used + 200;
    z = (char *) realloc(z,  alloced);
  }
  if( z==0 ) return empty;
  while( n-- > 0 ){
    c = *(zText++);
    if( c=='%' && n>0 && zText[0]=='d' ){







|







3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
  if( n<=0 ){
    if( n<0 ){
      used += n;
      assert( used>=0 );
    }
    n = lemonStrlen(zText);
  }
  if( (int) (n+sizeof(zInt)*2+used) >= alloced ){
    alloced = n + sizeof(zInt)*2 + used + 200;
    z = (char *) realloc(z,  alloced);
  }
  if( z==0 ) return empty;
  while( n-- > 0 ){
    c = *(zText++);
    if( c=='%' && n>0 && zText[0]=='d' ){