simon-git: puzzles (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Oct 1 16:49:04 BST 2017


TL;DR:
  edcf839 Fix an int->pointer cast warning in windows.c.
  eeb2db2 New name UI_UPDATE for interpret_move's return "".
  de67801 Use a proper union in struct config_item.
  b3243d7 Return error messages as 'const char *', not 'char *'.
  3276376 Assorted char * -> const char * API changes.
  a58c1b2 Make the code base clean under -Wwrite-strings.

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2017-10-01 16:49:04

commit edcf839d4c557c3993d681665829390697353344
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=edcf839d4c557c3993d681665829390697353344;hp=8ea15f3b3525d2ef5341f8122871c4f0ff77260a
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 14:50:58 2017 +0100

    Fix an int->pointer cast warning in windows.c.
    
    If I increase clang-cl's warning pickiness, it starts objecting to my
    cast to HMENU from a (potentially, in 64 bits) smaller integer type.
    
    Actually I don't think there's a problem there - all the integer ids I
    cast to HMENU are nice small numbers and a widening cast is just fine.
    But I can suppress the warning by using INT_PTR instead of int in the
    prototype for mkctrl, so it's easiest just to do that.

 windows.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit eeb2db283de9115f7256fa4cc49597d63e06b0ab
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=eeb2db283de9115f7256fa4cc49597d63e06b0ab;hp=edcf839d4c557c3993d681665829390697353344
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 12:52:12 2017 +0100

    New name UI_UPDATE for interpret_move's return "".
    
    Now midend.c directly tests the returned pointer for equality to this
    value, instead of checking whether it's the empty string.
    
    A minor effect of this is that games may now return a dynamically
    allocated empty string from interpret_move() and treat it as just
    another legal move description. But I don't expect anyone to be
    perverse enough to actually do that! The main purpose is that it
    avoids returning a string literal from a function whose return type is
    a pointer to _non-const_ char, i.e. we are now one step closer to
    being able to make this code base clean under -Wwrite-strings.

 blackbox.c         | 10 +++++-----
 bridges.c          | 24 ++++++++++++------------
 devel.but          |  8 ++++----
 dominosa.c         |  4 ++--
 filling.c          | 18 +++++++++---------
 flip.c             |  4 ++--
 flood.c            |  8 ++++----
 galaxies.c         | 16 ++++++++--------
 guess.c            | 22 +++++++++++-----------
 keen.c             |  8 ++++----
 lightup.c          |  2 +-
 magnets.c          |  6 +++---
 map.c              | 20 ++++++++++----------
 midend.c           |  3 ++-
 mines.c            | 12 ++++++------
 misc.c             |  2 ++
 net.c              |  4 ++--
 netslide.c         |  4 ++--
 palisade.c         |  2 +-
 pattern.c          | 12 ++++++------
 pearl.c            | 24 ++++++++++++------------
 pegs.c             | 20 ++++++++++----------
 puzzles.h          |  8 ++++++++
 range.c            |  4 ++--
 rect.c             |  8 ++++----
 samegame.c         |  2 +-
 signpost.c         | 28 ++++++++++++++++------------
 singles.c          |  2 +-
 sixteen.c          | 10 +++++-----
 slant.c            |  4 ++--
 solo.c             |  8 ++++----
 tents.c            | 12 ++++++------
 towers.c           |  8 ++++----
 tracks.c           | 20 ++++++++++----------
 twiddle.c          |  4 ++--
 undead.c           | 22 +++++++++++-----------
 unequal.c          | 13 +++++++------
 unfinished/group.c | 20 ++++++++++----------
 unfinished/slide.c |  4 ++--
 unruly.c           |  2 +-
 untangle.c         |  6 +++---
 41 files changed, 217 insertions(+), 201 deletions(-)

commit de67801b0fd3dfa11777c1ef86cd617baf376b7b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=de67801b0fd3dfa11777c1ef86cd617baf376b7b;hp=eeb2db283de9115f7256fa4cc49597d63e06b0ab
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 13:38:35 2017 +0100

    Use a proper union in struct config_item.
    
    This allows me to use different types for the mutable, dynamically
    allocated string value in a C_STRING control and the fixed constant
    list of option names in a C_CHOICES.

 blackbox.c           | 20 ++++++--------
 bridges.c            | 42 +++++++++++++---------------
 cube.c               | 18 +++++-------
 devel.but            | 77 ++++++++++++++++++++++++++++++++++------------------
 dominosa.c           | 12 +++-----
 emcc.c               | 30 ++++++++++++++++----
 fifteen.c            | 12 +++-----
 filling.c            | 12 +++-----
 flip.c               | 18 +++++-------
 flood.c              | 22 ++++++---------
 galaxies.c           | 18 +++++-------
 gtk.c                | 26 +++++++++++-------
 guess.c              | 27 +++++++-----------
 inertia.c            | 12 +++-----
 keen.c               | 18 +++++-------
 lightup.c            | 29 ++++++++------------
 loopy.c              | 24 +++++++---------
 magnets.c            | 23 ++++++----------
 map.c                | 23 ++++++----------
 midend.c             | 10 +++----
 mines.c              | 24 ++++++----------
 misc.c               |  2 +-
 nestedvm.c           | 24 ++++++++++++----
 net.c                | 27 +++++++-----------
 netslide.c           | 27 +++++++-----------
 osx.m                | 24 +++++++++-------
 palisade.c           | 24 +++++++++++-----
 pattern.c            | 12 +++-----
 pearl.c              | 23 ++++++----------
 pegs.c               | 18 +++++-------
 puzzles.h            | 52 +++++++++++++++++++----------------
 range.c              | 12 +++-----
 rect.c               | 22 ++++++---------
 samegame.c           | 28 ++++++++-----------
 signpost.c           | 17 ++++--------
 singles.c            | 18 +++++-------
 sixteen.c            | 17 ++++--------
 slant.c              | 18 +++++-------
 solo.c               | 39 +++++++++++---------------
 tents.c              | 18 +++++-------
 towers.c             | 13 ++++-----
 tracks.c             | 22 ++++++---------
 twiddle.c            | 32 ++++++++--------------
 undead.c             | 18 +++++-------
 unequal.c            | 19 ++++++-------
 unfinished/group.c   | 18 +++++-------
 unfinished/slide.c   | 17 ++++--------
 unfinished/sokoban.c | 12 +++-----
 unruly.c             | 22 ++++++---------
 untangle.c           |  7 ++---
 windows.c            | 72 +++++++++++++++++++++++-------------------------
 51 files changed, 528 insertions(+), 643 deletions(-)

commit b3243d75043cf1d70beb88d2a36eaebfe85c2c3f
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b3243d75043cf1d70beb88d2a36eaebfe85c2c3f;hp=de67801b0fd3dfa11777c1ef86cd617baf376b7b
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 13:53:24 2017 +0100

    Return error messages as 'const char *', not 'char *'.
    
    They're never dynamically allocated, and are almost always string
    literals, so const is more appropriate.

 blackbox.c            |  6 +++---
 bridges.c             |  6 +++---
 cube.c                |  6 +++---
 devel.but             | 26 +++++++++++++-------------
 dominosa.c            |  6 +++---
 emcc.c                |  6 +++---
 fifteen.c             |  9 +++++----
 filling.c             |  6 +++---
 flip.c                |  6 +++---
 flood.c               |  6 +++---
 galaxies.c            |  9 +++++----
 gtk.c                 | 22 ++++++++++++----------
 guess.c               |  6 +++---
 inertia.c             |  9 +++++----
 keen.c                |  9 +++++----
 lightup.c             |  9 +++++----
 loopy.c               | 11 ++++++-----
 magnets.c             |  9 +++++----
 map.c                 |  9 +++++----
 midend.c              | 37 +++++++++++++++++++++----------------
 mines.c               |  9 +++++----
 nestedvm.c            |  4 ++--
 net.c                 |  6 +++---
 netslide.c            |  6 +++---
 nullgame.c            |  6 +++---
 osx.m                 |  4 ++--
 palisade.c            |  6 +++---
 pattern.c             |  9 +++++----
 pearl.c               |  9 +++++----
 pegs.c                |  6 +++---
 puzzles.h             | 25 +++++++++++++------------
 range.c               |  6 +++---
 rect.c                |  6 +++---
 samegame.c            |  6 +++---
 signpost.c            | 14 ++++++++------
 singles.c             |  9 +++++----
 sixteen.c             |  6 +++---
 slant.c               |  9 +++++----
 solo.c                | 28 +++++++++++++++-------------
 tents.c               |  9 +++++----
 towers.c              |  9 +++++----
 tracks.c              |  6 +++---
 twiddle.c             |  6 +++---
 undead.c              |  6 +++---
 unequal.c             | 11 ++++++-----
 unfinished/group.c    | 11 ++++++-----
 unfinished/separate.c |  6 +++---
 unfinished/slide.c    |  6 +++---
 unfinished/sokoban.c  |  6 +++---
 unruly.c              |  9 +++++----
 untangle.c            |  6 +++---
 windows.c             | 19 ++++++++++++-------
 52 files changed, 266 insertions(+), 231 deletions(-)

commit 3276376d1be74b66970b88c3e941dcedf8d22474
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=3276376d1be74b66970b88c3e941dcedf8d22474;hp=b3243d75043cf1d70beb88d2a36eaebfe85c2c3f
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 14:04:47 2017 +0100

    Assorted char * -> const char * API changes.
    
    I went through all the char * parameters and return values I could see
    in puzzles.h by eye and spotted ones that surely ought to have been
    const all along.

 combi.c           |  2 +-
 devel.but         | 14 ++++++++------
 drawing.c         |  4 ++--
 emcc.c            |  9 +++++----
 gtk.c             | 10 +++++-----
 midend.c          | 34 ++++++++++++++++++++++------------
 misc.c            |  2 +-
 nestedvm.c        |  6 +++---
 nullfe.c          | 11 ++++++-----
 osx.m             | 17 +++++++++--------
 ps.c              |  3 ++-
 puzzles.h         | 21 +++++++++++----------
 unequal.c         |  2 +-
 unfinished/path.c |  2 +-
 untangle.c        |  2 +-
 windows.c         |  9 +++++----
 16 files changed, 83 insertions(+), 65 deletions(-)

commit a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac;hp=3276376d1be74b66970b88c3e941dcedf8d22474
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Oct 1 14:45:12 2017 +0100

    Make the code base clean under -Wwrite-strings.
    
    I've also added that warning option and -Werror to the build script,
    so that I'll find out if I break this property in future.

 Buildscr   | 10 +++++-----
 blackbox.c |  2 +-
 cube.c     |  2 +-
 devel.but  |  3 +--
 dominosa.c |  2 +-
 emcc.c     |  2 +-
 fifteen.c  |  2 +-
 filling.c  |  2 +-
 galaxies.c |  9 +++++----
 grid.c     | 15 ++++++++-------
 grid.h     |  4 ++--
 gtk.c      | 10 +++++-----
 guess.c    |  8 +++++---
 inertia.c  |  3 ++-
 keen.c     |  4 ++--
 latin.c    |  8 ++++----
 latin.h    |  4 ++--
 loopy.c    |  5 +++--
 map.c      | 15 ++++++++-------
 midend.c   | 19 ++++++++++---------
 mines.c    |  2 +-
 osx.m      |  2 +-
 ps.c       |  4 ++--
 puzzles.h  |  2 +-
 range.c    |  2 +-
 samegame.c |  3 ++-
 signpost.c |  7 ++++---
 singles.c  |  6 +++---
 sixteen.c  |  3 +--
 slant.c    |  4 ++--
 solo.c     | 24 +++++++++++++-----------
 tents.c    |  3 ++-
 twiddle.c  |  4 ++--
 unequal.c  |  6 +++---
 windows.c  |  2 +-
 35 files changed, 107 insertions(+), 96 deletions(-)



More information about the tartarus-commits mailing list