Fossil

Check-in [98e69442]
Login

Check-in [98e69442]

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

Overview
Comment:Fix over-length source code lines and memory leaks in the 'clean' command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-1.34
Files: files | file ages | folders
SHA1: 98e694422a79a541999722c039d06df082421686
User & Date: mistachkin 2015-11-04 23:41:55
Context
2015-11-04
23:42
Make the --with-tcl configure option able to cope with systems where using '-lieee' from TCL_LIB_SPEC appears to cause issues. ... (check-in: 7a0d543a user: mistachkin tags: branch-1.34)
23:41
Fix over-length source code lines and memory leaks in the 'clean' command. ... (check-in: 98e69442 user: mistachkin tags: branch-1.34)
23:41
Permit compilation without Tcl private stubs using Tcl 8.5. ... (check-in: e0773f3d user: mistachkin tags: branch-1.34)
2015-11-03
00:46
Fix over-length source code lines and memory leaks in the “clean” command. ... (check-in: 4c8b1e81 user: drh tags: clean-cmd-cleanup)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
** Copyright (c) 2007 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the Simplified BSD License (also
** known as the "2-Clause License" or "FreeBSD License".)

** This program is distributed in the hope that it will be useful,
** but without any warranty; without even the implied warranty of
** merchantability or fitness for a particular purpose.
**
** Author contact information:
**   drh@hwaci.com
**   http://www.hwaci.com/drh/






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
** Copyright (c) 2007 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the Simplified BSD License (also
** known as the "2-Clause License" or "FreeBSD License".)
**
** This program is distributed in the hope that it will be useful,
** but without any warranty; without even the implied warranty of
** merchantability or fitness for a particular purpose.
**
** Author contact information:
**   drh@hwaci.com
**   http://www.hwaci.com/drh/
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
      (blob_size(&where)>0) ? "OR" : "AND", zName,
      filename_collation(), zName, filename_collation(),
      zName, filename_collation()
    );
  }

  db_prepare(&q,
    "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0), islink"

    "  FROM vfile "
    " WHERE is_selected(id) %s"
    "   AND (chnged OR deleted OR rid=0 OR pathname!=origname)"
    " ORDER BY 1 /*scan*/",
    blob_sql_text(&where)
  );
  blob_zero(&rewrittenPathname);







|
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
      (blob_size(&where)>0) ? "OR" : "AND", zName,
      filename_collation(), zName, filename_collation(),
      zName, filename_collation()
    );
  }

  db_prepare(&q,
    "SELECT pathname, deleted, chnged,"
    "       rid, coalesce(origname!=pathname,0), islink"
    "  FROM vfile "
    " WHERE is_selected(id) %s"
    "   AND (chnged OR deleted OR rid=0 OR pathname!=origname)"
    " ORDER BY 1 /*scan*/",
    blob_sql_text(&where)
  );
  blob_zero(&rewrittenPathname);
433
434
435
436
437
438
439
440

441
442
443
444
445
446
447
       "       datetime(checkin_mtime(%d,rid),'unixepoch'%s)"
       "  FROM vfile %s"
       " ORDER BY %s",
       vid, timeline_utc(), blob_sql_text(&where), zOrderBy /*safe-for-%s*/
    );
  }else{
    db_prepare(&q,
       "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0), islink"

       "  FROM vfile %s"
       " ORDER BY %s", blob_sql_text(&where), zOrderBy /*safe-for-%s*/
    );
  }
  blob_reset(&where);
  while( db_step(&q)==SQLITE_ROW ){
    const char *zPathname = db_column_text(&q,0);







|
>







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
       "       datetime(checkin_mtime(%d,rid),'unixepoch'%s)"
       "  FROM vfile %s"
       " ORDER BY %s",
       vid, timeline_utc(), blob_sql_text(&where), zOrderBy /*safe-for-%s*/
    );
  }else{
    db_prepare(&q,
       "SELECT pathname, deleted, rid, chnged,"
       "       coalesce(origname!=pathname,0), islink"
       "  FROM vfile %s"
       " ORDER BY %s", blob_sql_text(&where), zOrderBy /*safe-for-%s*/
    );
  }
  blob_reset(&where);
  while( db_step(&q)==SQLITE_ROW ){
    const char *zPathname = db_column_text(&q,0);
794
795
796
797
798
799
800

801
802
803
804
805
806
807
            char *prompt = mprintf("\nWARNING: Deletion of this file will "
                                   "not be undoable via the 'undo'\n"
                                   "         command because %s.\n\n"
                                   "Remove unmanaged file \"%s\" (a=all/y/N)? ",
                                   undo_save_message(undoRc), zName+nRoot);
            prompt_user(prompt, &ans);
            cReply = blob_str(&ans)[0];

            blob_reset(&ans);
          }else{
            cReply = 'N';
          }
          if( cReply=='a' || cReply=='A' ){
            allFileFlag = 1;
          }else if( cReply!='y' && cReply!='Y' ){







>







796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
            char *prompt = mprintf("\nWARNING: Deletion of this file will "
                                   "not be undoable via the 'undo'\n"
                                   "         command because %s.\n\n"
                                   "Remove unmanaged file \"%s\" (a=all/y/N)? ",
                                   undo_save_message(undoRc), zName+nRoot);
            prompt_user(prompt, &ans);
            cReply = blob_str(&ans)[0];
            fossil_free(prompt);
            blob_reset(&ans);
          }else{
            cReply = 'N';
          }
          if( cReply=='a' || cReply=='A' ){
            allFileFlag = 1;
          }else if( cReply!='y' && cReply!='Y' ){
847
848
849
850
851
852
853

854
855
856
857
858
859
860
        char cReply;
        if( !noPrompt ){
          Blob ans;
          char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
                                 zName+nRoot);
          prompt_user(prompt, &ans);
          cReply = blob_str(&ans)[0];

          blob_reset(&ans);
        }else{
          cReply = 'N';
        }
        if( cReply=='a' || cReply=='A' ){
          allDirFlag = 1;
        }else if( cReply!='y' && cReply!='Y' ){







>







850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
        char cReply;
        if( !noPrompt ){
          Blob ans;
          char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
                                 zName+nRoot);
          prompt_user(prompt, &ans);
          cReply = blob_str(&ans)[0];
          fossil_free(prompt);
          blob_reset(&ans);
        }else{
          cReply = 'N';
        }
        if( cReply=='a' || cReply=='A' ){
          allDirFlag = 1;
        }else if( cReply!='y' && cReply!='Y' ){