Fossil

Check-in [4c8b1e81]
Login

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 | clean-cmd-cleanup
Files: files | file ages | folders
SHA1: 4c8b1e819c1429cbe706e1bd4d972fdb8b97eaba
User & Date: drh 2015-11-03 00:46:20
Context
2015-11-04
23:41
Fix over-length source code lines and memory leaks in the 'clean' command. check-in: 98e69442 user: mistachkin tags: branch-1.34
2015-11-03
01:07
Add the -i or --prompt option to the "fossil clean" command. check-in: 1c9da04a user: drh tags: clean-cmd-cleanup
00:46
Fix over-length source code lines and memory leaks in the “clean” command. check-in: 4c8b1e81 user: drh tags: clean-cmd-cleanup
2015-11-02
23:05
Permit compilation without Tcl private stubs using Tcl 8.5. check-in: b500f89c user: mistachkin tags: trunk
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
..
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
...
433
434
435
436
437
438
439
440

441
442
443
444
445
446
447
...
794
795
796
797
798
799
800

801
802
803
804
805
806
807
...
847
848
849
850
851
852
853

854
855
856
857
858
859
860
/*
** 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/
................................................................................
      (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);
................................................................................
       "       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);
................................................................................
            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' ){
................................................................................
        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' ){






|







 







>
|







 







|
>







 







>







 







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
...
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
...
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
/*
** 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/
................................................................................
      (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);
................................................................................
       "       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);
................................................................................
            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' ){
................................................................................
        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' ){