本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
668B

  1. package yaml
  2. // Set the writer error and return false.
  3. func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool {
  4. emitter.error = yaml_WRITER_ERROR
  5. emitter.problem = problem
  6. return false
  7. }
  8. // Flush the output buffer.
  9. func yaml_emitter_flush(emitter *yaml_emitter_t) bool {
  10. if emitter.write_handler == nil {
  11. panic("write handler not set")
  12. }
  13. // Check if the buffer is empty.
  14. if emitter.buffer_pos == 0 {
  15. return true
  16. }
  17. if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
  18. return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error())
  19. }
  20. emitter.buffer_pos = 0
  21. return true
  22. }
上海开阖软件有限公司 沪ICP备12045867号-1