Style fixes. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 19daa6ce19b0fd7e5abe0bf72a95ff8801b36717
(DIR) parent 168ca94a5098b443f6ae1c4b81ba9bdb09dcd372
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Tue, 4 Oct 2016 11:01:03 -0500
Style fixes.
Diffstat:
sam/list.c | 10 +++++-----
sam/multi.c | 2 +-
sam/sam.h | 18 +++++++++---------
3 files changed, 15 insertions(+), 15 deletions(-)
---
(DIR) diff --git a/sam/list.c b/sam/list.c
@@ -9,11 +9,11 @@ growlist(List *l)
{
if(l->listptr==0 || l->nalloc==0){
l->nalloc = INCR;
- l->listptr = emalloc(INCR*sizeof(int64_t));
+ l->listptr = emalloc(INCR*sizeof(l->g));
l->nused = 0;
}else if(l->nused == l->nalloc){
- l->listptr = erealloc(l->listptr, (l->nalloc+INCR)*sizeof(int64_t));
- memset((void*)(l->longptr+l->nalloc), 0, INCR*sizeof(int64_t));
+ l->listptr = erealloc(l->listptr, (l->nalloc+INCR)*sizeof(l->g));
+ memset((void*)(l->longptr+l->nalloc), 0, INCR*sizeof(l->g));
l->nalloc += INCR;
}
}
@@ -24,7 +24,7 @@ growlist(List *l)
void
dellist(List *l, int i)
{
- memmove(&l->longptr[i], &l->longptr[i+1], (l->nused-(i+1))*sizeof(int64_t));
+ memmove(&l->longptr[i], &l->longptr[i+1], (l->nused-(i+1))*sizeof(l->g));
l->nused--;
}
@@ -35,7 +35,7 @@ void
inslist(List *l, int i, int64_t val)
{
growlist(l);
- memmove(&l->longptr[i+1], &l->longptr[i], (l->nused-i)*sizeof(int64_t));
+ memmove(&l->longptr[i+1], &l->longptr[i], (l->nused-i)*sizeof(l->g));
l->longptr[i] = val;
l->nused++;
}
(DIR) diff --git a/sam/multi.c b/sam/multi.c
@@ -68,7 +68,7 @@ sortname(File *f)
}
void
-state(File *f, int cleandirty)
+state(File *f, state_t cleandirty)
{
if(f == cmd)
return;
(DIR) diff --git a/sam/sam.h b/sam/sam.h
@@ -30,13 +30,13 @@ typedef struct Range Range;
typedef struct Rangeset Rangeset;
typedef struct String String;
-enum State
+typedef enum
{
Clean = ' ',
Dirty = '\'',
Unread = '-',
Readerr = '~'
-};
+} state_t;
struct Range
{
@@ -54,7 +54,7 @@ struct Address
File *f;
};
-struct List /* code depends on a int64_t being able to hold a pointer */
+struct List
{
int nalloc;
int nused;
@@ -98,7 +98,7 @@ struct File
Buffer *buf; /* cached disc storage */
Buffer *transcript; /* what's been done */
Posn markp; /* file pointer to start of latest change */
- Mod mod; /* modification stamp */
+ Mod mod; /* modification stamp */
Posn nrunes; /* total length of file */
Posn hiposn; /* highest address touched this Mod */
Address dot; /* current position */
@@ -107,10 +107,10 @@ struct File
Range mark; /* tagged spot in text (don't confuse with Mark) */
List *rasp; /* map of what terminal's got */
String name; /* file name */
- int16_t tag; /* for communicating with terminal */
- char state; /* Clean, Dirty, Unread, or Readerr*/
- char closeok; /* ok to close file? */
- char deleted; /* delete at completion of command */
+ int16_t tag; /* for communicating with terminal */
+ state_t state; /* Clean, Dirty, Unread, or Readerr*/
+ bool closeok; /* ok to close file? */
+ bool deleted; /* delete at completion of command */
bool marked; /* file has been Fmarked at least once; once
* set, this will never go off as undo doesn't
* revert to the dawn of time */
@@ -242,7 +242,7 @@ int skipbl(void);
void snarf(File*, Posn, Posn, Buffer*, bool);
void sortname(File*);
void startup(char*, int, char**, char**);
-void state(File*, int);
+void state(File*, state_t);
int statfd(int, uint64_t*, uint64_t*, int64_t*, int64_t*, int64_t*);
int statfile(char*, uint64_t*, uint64_t*, int64_t*, int64_t*, int64_t*);
void Straddc(String*, int);