Skip to content
Browse files

Moved the default filename to constant

  • Loading branch information...
1 parent 0fc916e commit 8680b89b430ad96a7071e2f4b8b9059842db92e9 @jrbasso committed Jun 27, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 gistit.c
View
7 gistit.c
@@ -5,7 +5,10 @@
#include "jansson.h"
#define VERSION "0.1"
+
#define STDIN_BUFFER_SIZE 1024
+#define DEFAULT_STDIN_FILENAME "default.txt"
+
#define ENV_ACCESS_TOKEN_KEY "GISTIT_TOKEN"
#define GITHUB_GIST_URL "https://api.github.com/gists?access_token=%s"
@@ -181,8 +184,8 @@ int main(int argc, char *argv[])
if (filename == NULL) {
if (fakename == NULL) {
- fakename = (char *)malloc(15 * sizeof(char));
- strcpy(fakename, "default.txt");
+ fakename = (char *)malloc((strlen(DEFAULT_STDIN_FILENAME) + 1) * sizeof(char));
+ strcpy(fakename, DEFAULT_STDIN_FILENAME);
}
content = user_input();
} else {

0 comments on commit 8680b89

Please sign in to comment.
Something went wrong with that request. Please try again.