shithub: 9pro

Download patch

ref: 249ff28f6199e0562c5630f6dd0d17da261db4c9
parent: 96a53db2e0c0e981310e96fc2f44aad3fb94f98a
author: Sigrid Haflínudóttir <sigrid@gloot.com>
date: Mon Jan 25 13:52:27 EST 2021

Squashed 'c9/' changes from d24ba61..96d3672

96d3672 make it build on Plan 9 as well (with -D__plan9__)

git-subtree-dir: c9
git-subtree-split: 96d36720dd81338a92dad8fd151278da2c5c9cac

--- a/c9.c
+++ b/c9.c
@@ -5,8 +5,13 @@
  * any sense to copy-paste protocol documentation, which
  * you can read at http://man.cat-v.org/plan_9/5/, see 'intro'.
  */
+#ifdef __plan9__
+#include <u.h>
+#include <libc.h>
+#else
 #include <stdint.h>
 #include <string.h>
+#endif
 #include "c9.h"
 
 enum
@@ -717,10 +722,9 @@
 C9error
 s9flush(C9ctx *c, C9tag tag)
 {
-	uint8_t *b;
 	C9error err;
 
-	if((b = R(c, 0, Rflush, tag, &err)) != NULL)
+	if(R(c, 0, Rflush, tag, &err) != NULL)
 		err = c->end(c);
 	return err;
 }
@@ -880,10 +884,9 @@
 C9error
 s9clunk(C9ctx *c, C9tag tag)
 {
-	uint8_t *b;
 	C9error err;
 
-	if((b = R(c, 0, Rclunk, tag, &err)) != NULL)
+	if(R(c, 0, Rclunk, tag, &err) != NULL)
 		err = c->end(c);
 	return err;
 }
@@ -891,10 +894,9 @@
 C9error
 s9remove(C9ctx *c, C9tag tag)
 {
-	uint8_t *b;
 	C9error err;
 
-	if((b = R(c, 0, Rremove, tag, &err)) != NULL)
+	if(R(c, 0, Rremove, tag, &err) != NULL)
 		err = c->end(c);
 	return err;
 }
@@ -943,10 +945,9 @@
 C9error
 s9wstat(C9ctx *c, C9tag tag)
 {
-	uint8_t *b;
 	C9error err;
 
-	if((b = R(c, 0, Rwstat, tag, &err)) != NULL)
+	if(R(c, 0, Rwstat, tag, &err) != NULL)
 		err = c->end(c);
 	return err;
 }
--- a/c9.h
+++ b/c9.h
@@ -1,3 +1,12 @@
+#ifdef __plan9__
+typedef u64int uint64_t;
+typedef u32int uint32_t;
+typedef u16int uint16_t;
+typedef u8int uint8_t;
+#define __attribute__(...)
+#define NULL nil
+#endif
+
 struct C9aux;
 
 typedef struct C9r C9r;