Make mark a method, not a keyword.

This commit is contained in:
Nigel Tao committed 2017-10-26 12:31:27 +11:00
1 parent 36f5ae9bf4
commit 474a0d2ed7
11 files changed
+89 -17

No files matched your search

+20
View File
@@ -290,6 +290,12 @@ puffs_gif__status puffs_gif__lzw_decoder__decode(puffs_gif__lzw_decoder* self,
// See the License for the specific language governing permissions and
// limitations under the License.
// puffs_base__empty_struct is used when a Puffs function returns an empty
// struct. In C, if a function f returns void, you can't say "x = f()", but in
// Puffs, if a function g returns empty, you can say "y = g()".
typedef struct {
} puffs_base__empty_struct;
#define PUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)
// PUFFS_BASE__MAGIC is a magic number to check that initializers are called.
@@ -538,6 +544,20 @@ static inline uint32_t puffs_base__writer1__copy_from_slice32(
return n;
}
static inline puffs_base__empty_struct puffs_base__reader1__mark(
puffs_base__reader1* r,
uint8_t* m) {
r->private_impl.mark = m;
return ((puffs_base__empty_struct){});
}
static inline puffs_base__empty_struct puffs_base__writer1__mark(
puffs_base__writer1* w,
uint8_t* m) {
w->private_impl.mark = m;
return ((puffs_base__empty_struct){});
}
#endif // PUFFS_BASE_IMPL_H
// ---------------- Status Codes Implementations