]> git.ozlabs.org Git - ccan/commitdiff
Deleting duplicate grab_file in tools/
authordinesh <dinesh@dinesh-laptop>
Sun, 3 Aug 2008 18:31:10 +0000 (00:01 +0530)
committerdinesh <dinesh@dinesh-laptop>
Sun, 3 Aug 2008 18:31:10 +0000 (00:01 +0530)
tools/_infotojson/infotojson.c
tools/doc_extract.c
tools/tools.h

index 86769bbccc59c1ac215773413dfbae570d930fcb..460cb7fe1cd815154dca70ed4162ce16b72eb090 100644 (file)
@@ -1,36 +1,6 @@
 /* This extract info from _info.c and create json file and also optionally store to db */
 #include "infotojson.h"
 
 /* This extract info from _info.c and create json file and also optionally store to db */
 #include "infotojson.h"
 
-/* This version adds one byte (for nul term) */
-static void *grab_file(void *ctx, const char *filename)
-{
-       unsigned int max = 16384, size = 0;
-       int ret, fd;
-       char *buffer;
-
-       if (streq(filename, "-"))
-               fd = dup(STDIN_FILENO);
-       else
-               fd = open(filename, O_RDONLY, 0);
-
-       if (fd < 0)
-               return NULL;
-
-       buffer = talloc_array(ctx, char, max+1);
-       while ((ret = read(fd, buffer + size, max - size)) > 0) {
-               size += ret;
-               if (size == max)
-                       buffer = talloc_realloc(ctx, buffer, char, max*=2 + 1);
-       }
-       if (ret < 0) {
-               talloc_free(buffer);
-               buffer = NULL;
-       } else
-               buffer[size] = '\0';
-       close(fd);
-       return buffer;
-}
-
 /*creating json structure for storing to file/db*/
 static struct json *createjson(char **infofile, char *author)
 {
 /*creating json structure for storing to file/db*/
 static struct json *createjson(char **infofile, char *author)
 {
@@ -56,10 +26,6 @@ static struct json *createjson(char **infofile, char *author)
         if (!jsonobj->module)
                errx(1, "talloc error");
                
         if (!jsonobj->module)
                errx(1, "talloc error");
                
-       //jsonobj->module = (char *)palloc(sizeof(char) * (modulename - 1));
-       //strncpy(jsonobj->module, infofile[0], modulename - 1);
-       //jsonobj->module[modulename - 1] = '\0';
-
        jsonobj->title = infofile[0];
        jsonobj->desc = &infofile[1];
        
        jsonobj->title = infofile[0];
        jsonobj->desc = &infofile[1];
        
index aa3f2206cc3bace91b18b657690d2d282084a9a1..b70325ea47f51a00f7db114024bbbc24e2089920 100644 (file)
 #include "talloc/talloc.h"
 #include "string/string.h"
 
 #include "talloc/talloc.h"
 #include "string/string.h"
 
-/* This version adds one byte (for nul term) */
-static void *grab_file(void *ctx, const char *filename)
-{
-       unsigned int max = 16384, size = 0;
-       int ret, fd;
-       char *buffer;
-
-       if (streq(filename, "-"))
-               fd = dup(STDIN_FILENO);
-       else
-               fd = open(filename, O_RDONLY, 0);
-
-       if (fd < 0)
-               return NULL;
-
-       buffer = talloc_array(ctx, char, max+1);
-       while ((ret = read(fd, buffer + size, max - size)) > 0) {
-               size += ret;
-               if (size == max)
-                       buffer = talloc_realloc(ctx, buffer, char, max*=2 + 1);
-       }
-       if (ret < 0) {
-               talloc_free(buffer);
-               buffer = NULL;
-       } else
-               buffer[size] = '\0';
-       close(fd);
-       return buffer;
-}
 
 int main(int argc, char *argv[])
 {
 
 int main(int argc, char *argv[])
 {
index fff962c7eb033cf08f7fe1939e2f231bef8caf74..f07627ebee99f4e10b62524c16be72a69f492d7c 100644 (file)
@@ -5,8 +5,5 @@
 
 char **get_deps(const void *ctx, const char *dir);
 
 
 char **get_deps(const void *ctx, const char *dir);
 
-void *grab_fd(const void *ctx, int fd);
-void *grab_file(const void *ctx, const char *filename);
-
 #endif /* CCAN_TOOLS_H */
 
 #endif /* CCAN_TOOLS_H */