subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1714030 - /subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c
Date Thu, 12 Nov 2015 12:37:02 GMT
Author: julianfoad
Date: Thu Nov 12 12:37:02 2015
New Revision: 1714030

URL: http://svn.apache.org/viewvc?rev=1714030&view=rev
Log:
On the 'move-tracking-2' branch: Fix oddities in 'linenoise.c' to avoid
several compiler warnings.

* subversion/svnmover/linenoise/linenoise.c
  (unsupported_term): Add 'const', as it is initialized with string
    constants.
  (linenoiseHistoryAdd): Don't redeclare, as it was already declared in the
    header.
  (linenoiseEditInsert,
   linenoiseEditMoveLeft,
   linenoiseEditMoveRight,
   linenoiseEditMoveHome,
   linenoiseEditMoveEnd,
   linenoiseEditHistoryNext,
   linenoiseEditDelete,
   linenoiseEditBackspace,
   linenoiseEditDeletePrevWord): Declare as 'static', as they are not
    declared in the header.

Modified:
    subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c

Modified: subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c?rev=1714030&r1=1714029&r2=1714030&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/linenoise/linenoise.c Thu Nov
12 12:37:02 2015
@@ -118,7 +118,7 @@
 
 #define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100
 #define LINENOISE_MAX_LINE 4096
-static char *unsupported_term[] = {"dumb","cons25","emacs",NULL};
+static const char *unsupported_term[] = {"dumb","cons25","emacs",NULL};
 static linenoiseCompletionCallback *completionCallback = NULL;
 
 static struct termios orig_termios; /* In order to restore at exit.*/
@@ -170,7 +170,6 @@ enum KEY_ACTION{
 };
 
 static void linenoiseAtExit(void);
-int linenoiseHistoryAdd(const char *line);
 static void refreshLine(struct linenoiseState *l);
 
 /* Debugging macro. */
@@ -591,7 +590,7 @@ static void refreshLine(struct linenoise
 /* Insert the character 'c' at cursor current position.
  *
  * On error writing to the terminal -1 is returned, otherwise 0. */
-int linenoiseEditInsert(struct linenoiseState *l, char c) {
+static int linenoiseEditInsert(struct linenoiseState *l, char c) {
     if (l->len < l->buflen) {
         if (l->len == l->pos) {
             l->buf[l->pos] = c;
@@ -618,7 +617,7 @@ int linenoiseEditInsert(struct linenoise
 }
 
 /* Move cursor on the left. */
-void linenoiseEditMoveLeft(struct linenoiseState *l) {
+static void linenoiseEditMoveLeft(struct linenoiseState *l) {
     if (l->pos > 0) {
         l->pos--;
         refreshLine(l);
@@ -626,7 +625,7 @@ void linenoiseEditMoveLeft(struct lineno
 }
 
 /* Move cursor on the right. */
-void linenoiseEditMoveRight(struct linenoiseState *l) {
+static void linenoiseEditMoveRight(struct linenoiseState *l) {
     if (l->pos != l->len) {
         l->pos++;
         refreshLine(l);
@@ -634,7 +633,7 @@ void linenoiseEditMoveRight(struct linen
 }
 
 /* Move cursor to the start of the line. */
-void linenoiseEditMoveHome(struct linenoiseState *l) {
+static void linenoiseEditMoveHome(struct linenoiseState *l) {
     if (l->pos != 0) {
         l->pos = 0;
         refreshLine(l);
@@ -642,7 +641,7 @@ void linenoiseEditMoveHome(struct lineno
 }
 
 /* Move cursor to the end of the line. */
-void linenoiseEditMoveEnd(struct linenoiseState *l) {
+static void linenoiseEditMoveEnd(struct linenoiseState *l) {
     if (l->pos != l->len) {
         l->pos = l->len;
         refreshLine(l);
@@ -653,7 +652,7 @@ void linenoiseEditMoveEnd(struct linenoi
  * entry as specified by 'dir'. */
 #define LINENOISE_HISTORY_NEXT 0
 #define LINENOISE_HISTORY_PREV 1
-void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
+static void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
     if (history_len > 1) {
         /* Update the current history entry before to
          * overwrite it with the next one. */
@@ -677,7 +676,7 @@ void linenoiseEditHistoryNext(struct lin
 
 /* Delete the character at the right of the cursor without altering the cursor
  * position. Basically this is what happens with the "Delete" keyboard key. */
-void linenoiseEditDelete(struct linenoiseState *l) {
+static void linenoiseEditDelete(struct linenoiseState *l) {
     if (l->len > 0 && l->pos < l->len) {
         memmove(l->buf+l->pos,l->buf+l->pos+1,l->len-l->pos-1);
         l->len--;
@@ -687,7 +686,7 @@ void linenoiseEditDelete(struct linenois
 }
 
 /* Backspace implementation. */
-void linenoiseEditBackspace(struct linenoiseState *l) {
+static void linenoiseEditBackspace(struct linenoiseState *l) {
     if (l->pos > 0 && l->len > 0) {
         memmove(l->buf+l->pos-1,l->buf+l->pos,l->len-l->pos);
         l->pos--;
@@ -699,7 +698,7 @@ void linenoiseEditBackspace(struct linen
 
 /* Delete the previosu word, maintaining the cursor at the start of the
  * current word. */
-void linenoiseEditDeletePrevWord(struct linenoiseState *l) {
+static void linenoiseEditDeletePrevWord(struct linenoiseState *l) {
     size_t old_pos = l->pos;
     size_t diff;
 



Mime
View raw message