{"thread":{"id":"21981","subject":"[PATCH 2/2] technical-docs: document hash API","startedAt":"2009-12-18T00:05:28Z","lastAt":"2009-12-18T00:42:58Z","messageCount":3,"participants":["Stephen Boyd","Miklos Vajna"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"130049","messageId":"1261094729-24128-1-git-send-email-bebarino@gmail.com","threadId":"21981","inReplyTo":null,"subject":"[PATCH 1/2] api-strbuf.txt: fix typos and document launch_editor()","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-12-18T00:05:28Z","receivedAt":"2009-12-18T00:05:28Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n Documentation/technical/api-strbuf.txt |   10 ++++++++--\n 1 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt\nindex 7438149..a0e0f85 100644\n--- a/Documentation/technical/api-strbuf.txt\n+++ b/Documentation/technical/api-strbuf.txt\n@@ -12,7 +12,7 @@ strbuf API actually relies on the string being free of NULs.\n \n strbufs has some invariants that are very important to keep in mind:\n \n-. The `buf` member is never NULL, so you it can be used in any usual C\n+. The `buf` member is never NULL, so it can be used in any usual C\n string operations safely. strbuf's _have_ to be initialized either by\n `strbuf_init()` or by `= STRBUF_INIT` before the invariants, though.\n +\n@@ -55,7 +55,7 @@ Data structures\n \n * `struct strbuf`\n \n-This is string buffer structure. The `len` member can be used to\n+This is the string buffer structure. The `len` member can be used to\n determine the current length of the string, and `buf` member provides access to\n the string itself.\n \n@@ -253,3 +253,9 @@ same behaviour as well.\n \tcomments are considered contents to be removed or not.\n \n `launch_editor`::\n+\n+\tLaunch the user preferred editor to edit a file and fill the buffer\n+\twith the file's contents upon the user completing their editing. The\n+\tthird argument can be used to set the environment which the editor is\n+\trun in. If the buffer is NULL the editor is launched as usual but the\n+\tfile's contents are not read into the buffer upon completion.\n-- \n1.6.6.rc3.1.g8df51\n"},{"id":"130048","messageId":"1261094729-24128-2-git-send-email-bebarino@gmail.com","threadId":"21981","inReplyTo":"1261094729-24128-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 2/2] technical-docs: document hash API","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-12-18T00:05:29Z","receivedAt":"2009-12-18T00:05:29Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n Documentation/technical/api-hash.txt |   50 ++++++++++++++++++++++++++++++++-\n 1 files changed, 48 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/technical/api-hash.txt b/Documentation/technical/api-hash.txt\nindex c784d3e..e5061e0 100644\n--- a/Documentation/technical/api-hash.txt\n+++ b/Documentation/technical/api-hash.txt\n@@ -1,6 +1,52 @@\n hash API\n ========\n \n-Talk about <hash.h>\n+The hash API is a collection of simple hash table functions. Users are expected\n+to implement their own hashing.\n \n-(Linus)\n+Data Structures\n+---------------\n+\n+`struct hash_table`::\n+\n+\tThe hash table structure. The `array` member points to the hash table\n+\tentries. The `size` member counts the total number of valid and invalid\n+\tentries in the table. The `nr` member keeps track of the number of\n+\tvalid entries.\n+\n+`struct hash_table_entry`::\n+\n+\tAn opaque structure representing an entry in the hash table. The `hash`\n+\tmember is the entry's hash key and the `ptr` member is the entry's\n+\tvalue.\n+\n+Functions\n+---------\n+\n+`init_hash`::\n+\n+\tInitialize the hash table.\n+\n+`free_hash`::\n+\n+\tRelease memory associated with the hash table.\n+\n+`insert_hash`::\n+\n+\tInsert a pointer into the hash table. If an entry with that hash\n+\talready exists, a pointer to the existing entry's value is returned.\n+\tOtherwise NULL is returned.  This allows callers to implement\n+\tchaining, etc.\n+\n+`lookup_hash`::\n+\n+\tLookup an entry in the hash table. If an entry with that hash exists\n+\tthe entry's value is returned. Otherwise NULL is returned.\n+\n+`for_each_hash`::\n+\n+\tCall a function for each entry in the hash table. The function is\n+\texpected to take the entry's value as its only argument and return an\n+\tint. If the function returns a negative int the loop is aborted\n+\timmediately.  Otherwise, the return value is accumulated and the sum\n+\treturned upon completion of the loop.\n-- \n1.6.6.rc3.1.g8df51\n"},{"id":"130052","messageId":"20091218004258.GV25474@genesis.frugalware.org","threadId":"21981","inReplyTo":"1261094729-24128-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/2] api-strbuf.txt: fix typos and document launch_editor()","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-12-18T00:42:58Z","receivedAt":"2009-12-18T00:42:58Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Thu, Dec 17, 2009 at 04:05:28PM -0800, Stephen Boyd <bebarino@gmail.com> wrote:\n> Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n> ---\n>  Documentation/technical/api-strbuf.txt |   10 ++++++++--\n>  1 files changed, 8 insertions(+), 2 deletions(-)\n\nThanks, I really should have read these sentences once again before\nsending them in. ;-)\n"}]}